If we take another look at our brand new validator template, we can see a certain amount of code bloat; the form.get('Title') method is called no less than five times, and all those long lines pose a serious threat to our template's readability. Is there a way to address that?
As a matter of fact, there is--whenever we feel like we're writing too much code or repeating a complex task too many times, we can create one or more helper methods within our component class to centralize the underlying logic. In our specific scenario, we can add these methods to the QuizEditComponent class:
// retrieve a FormControlgetFormControl(name: string) { return this.form.get(name);}// returns TRUE if the FormControl is validisValid(name: ...