February 2019
Intermediate to advanced
446 pages
10h 55m
English
The login component uses the FormBuilder, FormGroup, and Validators classes from Angular forms. FormBuilder allows us to build formGroup with username and password fields. Validators provides the validation feature. get f() is just created as a shortcut to access the form fields. You might have observed it in the HTML template.
Inside LoginComponent, we define the onSubmit operations, which are called from the login.component.html template when a user clicks on the Reserve button:
import { Component, OnInit } from '@angular/core';import { Router, ActivatedRoute } from '@angular/router';import { FormBuilder, FormGroup, Validators } from '@angular/forms';import { first } from 'rxjs/operators';import { RestService } from '../rest.service'; ...Read now
Unlock full access