February 2019
Intermediate to advanced
446 pages
10h 55m
English
The login.component.html template consists of only two input fields, username and password, with the Login button that submits the login form.
Here, we are using formGroup with the ngSubmit directive. The login form is submitted using the ngSubmit directive that calls the onSubmit function of the LoginComponent class (more on this in the next section). Input values are bounded using the formControlName. We have also used the Angular Validators to validate these two fields:
<br><br><h2>Login</h2><form [formGroup]="loginForm" (ngSubmit)="onSubmit()"> <div class="form-group" class="row col-8"> </div> <div class="form-group" class="row col-8"> <label for="username">Username</label> <input type="text" ...
Read now
Unlock full access