-
Notifications
You must be signed in to change notification settings - Fork 184
/
Copy pathlogin-reactive.component.html
68 lines (57 loc) · 1.77 KB
/
login-reactive.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<mat-card class="login-page">
<mat-card-title>Login (Reactive)</mat-card-title>
<mat-card-content>
<form class="login-form data-form" [formGroup]="form">
<mat-form-field>
<input
matInput
type="email"
name="email"
placeholder="Email"
formControlName="email"
/>
<mat-error *ngIf="email.errors?.required"
>The email is mandatory.</mat-error
>
<mat-error *ngIf="email.errors?.minlength">
Your email must have minimum
{{ email.errors?.minlength.requiredLength }} chars, but it only has
{{ email.errors?.minlength.actualLength }}.
</mat-error>
<mat-error *ngIf="email.errors?.email"
>The email is not a valid email.</mat-error
>
</mat-form-field>
<mat-form-field>
<input
matInput
type="password"
placeholder="Password"
formControlName="password"
/>
<mat-error *ngIf="password.errors?.required"
>The password is mandatory</mat-error
>
</mat-form-field>
<ng-container
*ngIf="password.errors | onlyOneError : ['passwordStrength'] as error"
>
<div class="field-message" *ngIf="error.passwordStrength">
Your password must have lower case, upper case and numeric characters.
</div>
</ng-container>
<button mat-raised-button color="primary" [disabled]="!form.valid">
Login
</button>
<button mat-raised-button color="primary" (click)="reset()">
Reset
</button>
</form>
<div class="form-val">
{{ form.value | json }}
</div>
<div class="form-val">
{{ form.valid | json }}
</div>
</mat-card-content>
</mat-card>