1
+ < div class ="container d-flex justify-content-center align-items-center vh-100 ">
2
+ < div class ="card p-4 " style ="width: 300px; ">
3
+ < h2 class ="text-center mb-4 "> Sign Up</ h2 >
4
+ < form [formGroup] ="signupForm " (ngSubmit) ="onSubmit() ">
5
+ <!-- Email Field -->
6
+ < div class ="mb-3 ">
7
+ < input type ="email " class ="form-control " placeholder ="Email " formControlName ="email ">
8
+ < div *ngIf ="signupForm.get('email')?.invalid && signupForm.get('email')?.touched " class ="text-danger ">
9
+ < small *ngIf ="signupForm.get('email')?.errors?.['required'] "> Email is required.</ small >
10
+ < small *ngIf ="signupForm.get('email')?.errors?.['email'] "> Invalid email format.</ small >
11
+ </ div >
12
+ </ div >
13
+
14
+ <!-- Password Field -->
15
+ < div class ="mb-3 ">
16
+ < input type ="password " class ="form-control " placeholder ="Password " formControlName ="password ">
17
+ < div *ngIf ="signupForm.get('password')?.invalid && signupForm.get('password')?.touched " class ="text-danger ">
18
+ < small *ngIf ="signupForm.get('password')?.errors?.['required'] "> Password is required.</ small >
19
+ < small *ngIf ="signupForm.get('password')?.errors?.['minlength'] "> Password must be at least 6 characters.</ small >
20
+ </ div >
21
+ </ div >
22
+
23
+ <!-- Verify Password Field -->
24
+ < div class ="mb-3 ">
25
+ < input type ="password " class ="form-control " placeholder ="Verify Password " formControlName ="verifyPassword ">
26
+ < div *ngIf ="signupForm.get('verifyPassword')?.invalid && signupForm.get('verifyPassword')?.touched " class ="text-danger ">
27
+ < small *ngIf ="signupForm.get('verifyPassword')?.errors?.['required'] "> Verify Password is required.</ small >
28
+ </ div >
29
+ < div *ngIf ="signupForm.errors?.['mismatch'] && signupForm.get('verifyPassword')?.touched " class ="text-danger ">
30
+ < small > Passwords do not match.</ small >
31
+ </ div >
32
+ </ div >
33
+
34
+ <!-- Submit Button -->
35
+ < button type ="submit " class ="btn btn-primary w-100 " [disabled] ="signupForm.invalid "> Sign Up</ button >
36
+ </ form >
37
+
38
+ <!-- Link to Login Page -->
39
+ < div class ="mt-3 text-center ">
40
+ < p > Already have an account? < a routerLink ="/login "> Login</ a > </ p >
41
+ </ div >
42
+ </ div >
43
+ </ div >
0 commit comments