Created
June 14, 2017 06:12
-
-
Save Takas0522/62a85d78f99f056f1d638c1461966104 to your computer and use it in GitHub Desktop.
Angularv4ReactiveFormのやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from "@angular/core"; | |
import { FormBuilder } from "@angular/forms"; | |
import { BaseComponent } from "../base/base.component"; | |
import * as validSettings from "./validation-settings"; | |
@Component({ | |
templateUrl: "./reactive-firm-one.html", | |
}) | |
export class ReactiveFormOne extends BaseComponent implements OnInit { | |
formErrors = validSettings.FORM_ERRORS; | |
validationMessage = validSettings.VALIDATION_MESSAGES; | |
constructor( | |
private _fb: FormBuilder | |
){ | |
super(); | |
} | |
get USER_ID_CONTROL_KEYWORD(): string{ | |
return validSettings.USER_ID_CONTROL_KEYWORD; | |
} | |
get USER_NAME_CONTROL_KEYWORD(): string{ | |
return validSettings.USER_NAME_CONTROL_KEYWORD; | |
} | |
get PASSWORD_CONTROL_KEYWORD(): string{ | |
return validSettings.PASSWORD_CONTROL_KEYWORD; | |
} | |
ngOnInit(){ | |
this.buildForms(); | |
} | |
buildForms() { | |
this.inputForm = this._fb.group(validSettings.FORM_SETTING); | |
super.buildForms(); | |
} | |
onSubmit() { | |
this.allControlReCheck(); | |
if (this.inputForm.invalid) { | |
alert('えらーあるよ!') | |
} else { | |
this._router.navigate(["empty"]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment