Why is (ngModel) not working?

I have an example application for exploring angular 2. In my example application it [(ngModel)]does not work. But when I remove the square brackets (ngModel), the screen loads, but the two-way binding does not work.

should i do anything to create [(ngModel)].

+4
source share
1 answer

Your code probably doesn't have this import line in your module:

import { FormsModule } from '@angular/forms';

You also need to add FormsModule to the module import array:

@NgModule({
   imports:      [FormsModule, /*...*/ ],
   //...
})
+7
source

Source: https://habr.com/ru/post/1677225/


All Articles