Created
August 12, 2020 06:46
-
-
Save onwuvic/baaf51ee35a1199db818d3d8783870c6 to your computer and use it in GitHub Desktop.
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 { FormGroup, FormBuilder, Validators } from '@angular/forms'; | |
import { PasswordMatcher } from '../../shared/password-matcher'; | |
@Component({ | |
selector: 'app-sign-up', | |
templateUrl: './sign-up.component.html', | |
styleUrls: ['./sign-up.component.scss'] | |
}) | |
export class SignUpComponent implements OnInit { | |
signupForm: FormGroup; | |
// Use with the generic validation message class | |
displayMessage: { [key: string]: string } = {}; | |
constructor(private fb: FormBuilder) {} | |
ngOnInit() { | |
this.signupForm = this.fb.group({ | |
firstName: ['', [Validators.required]], | |
lastName: ['', [Validators.required]], | |
email: ['', [Validators.required, Validators.email]], | |
password: ['', [Validators.required, Validators.minLength(8)]], | |
confirmPassword: ['', Validators.required] | |
}, { validator: PasswordMatcher.match }); | |
} | |
signup() { | |
console.log('---form', this.signupForm.value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment