4

I have running the sample application to learn angular 2. In my sample application [(ngModel)] is not working. But when i removes the square brackets (ngModel) the screen is loading but two way binding is not working.

should i do anything for making [(ngModel)] work.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
ganku007
  • 101
  • 1
  • 11

1 Answers1

7

Probably your code is missing this import line in your module:

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

You also have to add FormsModule to module imports array:

@NgModule({
   imports:      [FormsModule, /*...*/ ],
   //...
})
Marius Orha
  • 670
  • 1
  • 9
  • 26