Complete the code to import FormsModule in the Angular component.
import { [1] } from '@angular/forms';
You need to import FormsModule from @angular/forms to use template-driven forms.
Complete the code to add FormsModule to the imports array in the NgModule decorator.
@NgModule({
imports: [[1]],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}Adding FormsModule to the imports array enables form features in your Angular app.
Fix the error in the template by completing the form tag with the correct directive.
<form #userForm="[1]"> <input name="username" ngModel> </form>
formGroup instead of ngForm in template-driven forms.The ngForm directive is automatically applied to template-driven forms to track form state.
Fill both blanks to bind the input field to the component property using two-way binding.
<input name="email" [( [1] )]="[2]">
formControl which is for reactive forms.value instead of using ngModel.Two-way binding uses [(ngModel)] to connect the input to the component's email property.
Fill all three blanks to create a form with a submit button that calls the submit method.
<form ([1])="[2]()" #userForm="ngForm"> <input name="password" [( [3] )]="password"> <button type="submit">Submit</button> </form>
click event on form instead of ngSubmit.ngModel for two-way binding.The form listens for ngSubmit event to call the submit method. The input uses two-way binding with ngModel.