Skip to content

Instantly share code, notes, and snippets.

View takuya-nakayasu's full-sized avatar

TAKUYA NAKAYASU takuya-nakayasu

View GitHub Profile
// profile route
 router.get('/profile/list', profileController.getProfileList);
router.get('/profile/list', function (req, res) {
res.send('Accessing the profile list');
});
router.post('/profile/create', function (req, res) {
res.send('POST request to the /profile/create');
});
router.get('/profile/:id', function (req, res) {
res.send('GET request to the /profile/' + req.params.id);
});
router.post('/profile/create', function (req, res) {
res.send('create ' + req.body.name + ' profile');
});
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
@takuya-nakayasu
takuya-nakayasu / double-click-prevention.directive.ts
Last active December 8, 2018 08:38
ボタンの連打を防止するAngularのディレクティブ
import { Directive, Input, ElementRef, HostListener } from '@angular/core';
/**
* 二重送信防止ディレクティブ
*
*/
@Directive({
selector: '[appDoubleClickPrevention]'
})
export class DoubleClickPreventionDirective {
@takuya-nakayasu
takuya-nakayasu / app.component.ts
Created December 8, 2018 10:53
コンポーネントクラス
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 {
@takuya-nakayasu
takuya-nakayasu / sample-directive.html
Last active December 8, 2018 10:59
今回作成したディレクティブの呼び出し例
<!-- 登録ボタン -->
<button [appDoubleClickPrevention]="isLoading"
type="submit" class="register-button"
mat-raised-button color="primary">登録</button>
@takuya-nakayasu
takuya-nakayasu / app.component.html
Last active December 8, 2018 10:59
コンポーネントクラスの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="氏名(姓と名の間にスペースを入力してください)"