Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

NAKAYASU TAKUYA l08084

🌴
On vacation
View GitHub Profile
View gist:bc55bb74f6e57d250dd94631b15a26eb
// profile route
 router.get('/profile/list', profileController.getProfileList);
View documentExample.ts
router.get('/profile/list', function (req, res) {
res.send('Accessing the profile list');
});
View documentExample2.ts
router.post('/profile/create', function (req, res) {
res.send('POST request to the /profile/create');
});
View documentExample3.ts
router.get('/profile/:id', function (req, res) {
res.send('GET request to the /profile/' + req.params.id);
});
View documentExample4.ts
router.post('/profile/create', function (req, res) {
res.send('create ' + req.body.name + ' profile');
});
View error.sh
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\b
in\\npm-cli.js" "install" "-g" "ionic" "cordova"
npm ERR! node v7.1.0
npm ERR! npm v3.10.9
npm ERR! path C:\Users\hitomi.kumai\AppData\Roaming\npm\node_modules\.staging\abbrev-3c97fc93
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
@l08084
l08084 / double-click-prevention.directive.ts
Last active Dec 8, 2018
ボタンの連打を防止するAngularのディレクティブ
View double-click-prevention.directive.ts
import { Directive, Input, ElementRef, HostListener } from '@angular/core';
/**
* 二重送信防止ディレクティブ
*
*/
@Directive({
selector: '[appDoubleClickPrevention]'
})
export class DoubleClickPreventionDirective {
@l08084
l08084 / sample-directive.html
Last active Dec 8, 2018
今回作成したディレクティブの呼び出し例
View sample-directive.html
<!-- 登録ボタン -->
<button [appDoubleClickPrevention]="isLoading"
type="submit" class="register-button"
mat-raised-button color="primary">登録</button>
@l08084
l08084 / app.component.html
Last active Dec 8, 2018
コンポーネントクラスのHTMLファイル
View app.component.html
<div class="container">
<mat-card class="login-card">
<mat-card-header>
<mat-card-title class="login-title">アカウント登録</mat-card-title>
</mat-card-header>
<mat-card-content>
<form [formGroup]="nameRegisterForm" (ngSubmit)="onSubmit()" class="login-form">
<!-- 氏名の入力フォーム -->
<mat-form-field class="input-field">
<input matInput placeholder="氏名(姓と名の間にスペースを入力してください)"
@l08084
l08084 / app.component.ts
Created Dec 8, 2018
コンポーネントクラス
View app.component.ts
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
import { CustomValidator } from './custom-validator';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
You can’t perform that action at this time.