1- < mat-card >
2- < mat-card-title > Register</ mat-card-title >
1+ < div >
2+ < a [routerLink] ="['../login'] "> Go to Login</ a >
3+ < mat-card >
4+ < mat-card-title > Register</ mat-card-title >
35
4- < mat-card-content >
5- < form [formGroup] ="registerForm " (ngSubmit) ="register() ">
6+ < mat-card-content >
7+ < form [formGroup] ="registerForm " (ngSubmit) ="register() ">
68
7- < mat-form-field >
8- < input type ="email " matInput placeholder ="Email " formControlName ="email ">
9- <!-- Here we can display error messages/hints for the user, if one of the Validators adds an error to the email
9+ < mat-form-field >
10+ < input type ="email " matInput placeholder ="Email " formControlName ="email ">
11+ <!-- Here we can display error messages/hints for the user, if one of the Validators adds an error to the email
1012 with the .touched check we only display the hints if the input was touched by the users -->
11- < mat-error
12- *ngIf ="this.registerForm.get('email')?.touched && this.registerForm.get('email')?.hasError('required') ">
13- Email is required</ mat-error >
14- < mat-error *ngIf ="this.registerForm.get('email')?.touched && this.registerForm.get('email')?.hasError('email') ">
15- Email must be a valid Email</ mat-error >
16- </ mat-form-field >
13+ < mat-error
14+ *ngIf ="this.registerForm.get('email')?.touched && this.registerForm.get('email')?.hasError('required') ">
15+ Email is required</ mat-error >
16+ < mat-error
17+ *ngIf ="this.registerForm.get('email')?.touched && this.registerForm.get('email')?.hasError('email') ">
18+ Email must be a valid Email</ mat-error >
19+ </ mat-form-field >
1720
18- < mat-form-field >
19- < input type ="text " matInput placeholder ="Username " formControlName ="username ">
20- < mat-error
21- *ngIf ="this.registerForm.get('username')?.touched && this.registerForm.get('username')?.hasError('required') ">
22- Username is required</ mat-error >
23- </ mat-form-field >
21+ < mat-form-field >
22+ < input type ="text " matInput placeholder ="Username " formControlName ="username ">
23+ < mat-error
24+ *ngIf ="this.registerForm.get('username')?.touched && this.registerForm.get('username')?.hasError('required') ">
25+ Username is required</ mat-error >
26+ </ mat-form-field >
2427
25- < mat-form-field >
26- < input type ="text " matInput placeholder ="First Name " formControlName ="firstname ">
27- < mat-error
28- *ngIf ="this.registerForm.get('firstname')?.touched && this.registerForm.get('firstname')?.hasError('required') ">
29- First Name is required</ mat-error >
30- </ mat-form-field >
28+ < mat-form-field >
29+ < input type ="text " matInput placeholder ="First Name " formControlName ="firstname ">
30+ < mat-error
31+ *ngIf ="this.registerForm.get('firstname')?.touched && this.registerForm.get('firstname')?.hasError('required') ">
32+ First Name is required</ mat-error >
33+ </ mat-form-field >
3134
32- < mat-form-field >
33- < input type ="text " matInput placeholder ="Last Name " formControlName ="lastname ">
34- < mat-error
35- *ngIf ="this.registerForm.get('lastname')?.touched && this.registerForm.get('lastname')?.hasError('required') ">
36- Last Name is required</ mat-error >
37- </ mat-form-field >
35+ < mat-form-field >
36+ < input type ="text " matInput placeholder ="Last Name " formControlName ="lastname ">
37+ < mat-error
38+ *ngIf ="this.registerForm.get('lastname')?.touched && this.registerForm.get('lastname')?.hasError('required') ">
39+ Last Name is required</ mat-error >
40+ </ mat-form-field >
3841
39- < mat-form-field >
40- < input type ="password " matInput placeholder ="Password " formControlName ="password ">
41- < mat-error
42- *ngIf ="this.registerForm.get('password')?.touched && this.registerForm.get('password')?.hasError('required') ">
43- Password is required</ mat-error >
44- </ mat-form-field >
42+ < mat-form-field >
43+ < input type ="password " matInput placeholder ="Password " formControlName ="password ">
44+ < mat-error
45+ *ngIf ="this.registerForm.get('password')?.touched && this.registerForm.get('password')?.hasError('required') ">
46+ Password is required</ mat-error >
47+ </ mat-form-field >
4548
46- < mat-form-field >
47- < input type ="password " matInput placeholder ="Password Confirmation " formControlName ="passwordConfirm ">
48- < mat-error
49- *ngIf ="this.registerForm.get('passwordConfirm')?.touched && this.registerForm.get('passwordConfirm')?.hasError('required') ">
50- Password Confirmation is required</ mat-error >
51- </ mat-form-field >
49+ < mat-form-field >
50+ < input type ="password " matInput placeholder ="Password Confirmation " formControlName ="passwordConfirm ">
51+ < mat-error
52+ *ngIf ="this.registerForm.get('passwordConfirm')?.touched && this.registerForm.get('passwordConfirm')?.hasError('required') ">
53+ Password Confirmation is required</ mat-error >
54+ </ mat-form-field >
5255
53- < mat-error
54- *ngIf ="this.registerForm.get('passwordConfirm')?.dirty && this.registerForm.hasError('passwordsNotMatching') ">
55- Passwords are not matching!</ mat-error >
56+ < mat-error
57+ *ngIf ="this.registerForm.get('passwordConfirm')?.dirty && this.registerForm.hasError('passwordsNotMatching') ">
58+ Passwords are not matching!</ mat-error >
5659
57- < div class ="button ">
58- <!-- Button is disabled(not clickable), if our RegisterForm contains Validation Errors -->
59- < button type ="submit " mat-button [disabled] ="!registerForm.valid "> Register</ button >
60- </ div >
60+ < div class ="button ">
61+ <!-- Button is disabled(not clickable), if our RegisterForm contains Validation Errors -->
62+ < button type ="submit " mat-button [disabled] ="!registerForm.valid "> Register</ button >
63+ </ div >
6164
62- </ form >
63- </ mat-card-content >
65+ </ form >
66+ </ mat-card-content >
6467
65- </ mat-card >
68+ </ mat-card >
69+ </ div >
0 commit comments