Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FORM VALIDTION
- this.userform = this._formbuilder.group({
- first_name: [this.user.first_name, Validators.required],
- last_name: ['', Validators.required],
- username: ['', Validators.compose(
- [
- Validators.required,Validators.minLength(5)
- ]
- )],
- password: ['',Validators.compose([
- Validators.required,ValidationService.passwordValidator
- ])],
- email: ['', Validators.compose([
- Validators.required,ValidationService.emailValidator
- ])],
- role: ['', Validators.required],
- })
- constructor(private _http:Http){}
- static passwordValidator(control) {
- if(control.value != undefined){
- if (!control.value.match(/^(?=.*[0-9])[a-zA-Z0-9!@#$%^&*]{6,100}$/)) {
- return { 'invalidPassword': true };
- }
- }
- }
- static emailValidator(){
- return this._http. //this returns an error i would like to
- //query server to see if email exists
- }
Add Comment
Please, Sign In to add comment