Template-Driven forms

If you come from AngularJS, there's a high chance that the Template-Driven approach will ring a bell or two. As the name implies, Template-Driven forms host most of the logic in the template code; working with a Template-Driven form means to build the form in the .html template file, to data bind the various input fields to a ngModel instance, and use a dedicated ngForm object, related to the whole form and containing all the inputs, each one of them being accessible through their name, to perform the required validity checks.

To better understand it, here's how a Template-Driven form looks:

<form novalidate autocomplete="off" #form="ngForm">        <input type="text" name="title" value="" required placeholder="Insert a title..." ...

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.