0

While binding ngModel to the input I am finding the following error -

Can't bind to 'ngModel' since it isn't a known property of 'input'. ("<div>
<span> Select : </span>
<input type="radio" name="options" value="all" [ERROR ->][(ngModel)]="SelectRadioButtonValue" (change)="onRadioButtonSelectionChanged()"  />
<span> {{"All: " "): ng:///AppModule/EmpCountComponent.html@2:47
Can't bind to 'ngModel' since it isn't a known property of 'input'. (">
<span> {{"male: " + '(' + male + ')' }} </span>
<input type="radio" name="options" value="female" [ERROR ->][(ngModel)]="SelectRadioButtonValue"   (change)="onRadioButtonSelectionChanged()" />
<span> {{"Female"): ng:///AppModule/EmpCountComponent.html@6:50
Anurag Ranjan
  • 242
  • 1
  • 4
  • 14
  • https://stackoverflow.com/questions/43298011/angular-4-cant-bind-to-ngmodel-since-it-isnt-a-known-property-of-input – kboul Jul 18 '18 at 14:26

1 Answers1

0

For using [(ngModel)] you should import FormsModule into your AppModule:

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

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
Gregor Doroschenko
  • 11,488
  • 5
  • 25
  • 37