September 2017
Intermediate to advanced
450 pages
11h 24m
English
Angular's FormsModule allows us to do a two-way data binding between component properties and our form input values. We must first include FormsModule into the imports declaration of our module in order to use this functionality. We must also declare to Angular the form element that will contain our data-bound inputs.
<form #formID="ngForm">...</form>
Behind the scenes, Angular will transform this form element into an ngForm directive, which will facilitate the input data binding for us. The data binding on the input is configured using the ngModel directive to bind the value of input to the declared property in the scope of our component. We must also provide a name value for the input for ngForm.
<input name="label" [(ngModel)]="property"></input> ...
Read now
Unlock full access