May 2018
Intermediate to advanced
512 pages
11h 3m
English
Before we move on, we need to implement validations for loginForm. As we implement more forms in Chapter 10, Angular App Design and Recipes, you will realize that it gets tedious, fast, to repeatedly type out form validations in either template or reactive forms. Part of the allure of reactive forms is that it is driven by code, so we can easily extract out the validations to a shared class, unit test, and reuse them:
src/app/common/validations.tsimport { Validators } from '@angular/forms'export const EmailValidation = [Validators.required, Validators.email]export const PasswordValidation = [ Validators.required, Validators.minLength(8), ...Read now
Unlock full access