Adding validators

As a matter of fact, we already added a basic validator to the createForm():

[...]        Title: ['', Validators.required],[...]

This will definitely make Angular aware of the fact that the quiz Form Model will never be valid as long as there's an empty Title, which is precisely what we want since Title is a required field.

Let's quickly test it out. Launch the project in debug mode, navigate through a quiz, click on the Edit button, and try to entirely remove the existing Title:

It works! It seems that we're unable to submit the form as long as the Title textbox is empty.

The only missing thing here is a visual warning of some ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.