In order to use two-way data binding for form inputs you need to import the FormsModule
package in your Angular module.
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
FormsModule
]
EDIT
Since there are lot of duplicate questions with the same problem, I am enhancing this answer.
There are two possible reasons
Missing FormsModule
, hence Add this to your Module,
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
FormsModule
]
Check the syntax/spelling of [(ngModel)]
in the input tag
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…