Skip to content

Commit c4cf659

Browse files
committed
Commit
1 parent 01da34e commit c4cf659

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/app/app.component.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
>>> body {
1+
body {
32
margin: 0;
43
}
54

@@ -10,7 +9,6 @@ main {
109
mat-toolbar {
1110
position: fixed;
1211
z-index: 1000;
13-
1412
}
1513

1614
.main-content {

src/app/login/login.component.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<mat-card class="login-page">
2+
23
<mat-card-title>Login</mat-card-title>
4+
35
<mat-card-content>
46

57
<form class="login-form data-form" #loginForm="ngForm" (ngSubmit)="login(loginForm, $event)">
68

79
<mat-form-field>
810

9-
<input matInput type="email" name="email" placeholder="Email" ngModel #email="ngModel" required minlength="3"
10-
maxlength="20" email>
11+
<input matInput type="email" name="email" placeholder="Email" ngModel [ngModelOptions]="{updateOn: 'blur'}"
12+
#email="ngModel" required minlength="3" maxlength="20" email (ngModelChange)="onEmailChange($event)">
1113
@if (email.hasError('required')) {
1214
<mat-error>Email is required.</mat-error>
1315
} @if (email.hasError('minlength')) {
@@ -34,7 +36,8 @@
3436

3537
</form>
3638

37-
<!-- <div class="form-val">{{ loginForm.value | json }}</div> -->
39+
<div class="form-val">{{ loginForm.value | json }}</div>
3840

3941
</mat-card-content>
42+
4043
</mat-card>

src/app/login/login.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ export class LoginComponent implements OnInit {
1515
login(loginForm: NgForm, submit: SubmitEvent) {
1616
console.log(loginForm.value, loginForm.valid, submit);
1717
}
18+
19+
onEmailChange(event: Event) {
20+
const input = event.target as HTMLInputElement;
21+
console.log(input.value);
22+
}
1823
}

0 commit comments

Comments
 (0)