我正在尝试从此组件中记录ngModel,以便我可以将其检查用于教育目的
<input ngModel name="firstName" id="firstName" type="text" #firstname="ngModel" (change)="log(firstname)" class="form-control">
但我收到此错误,我似乎无法诊断错误。
Uncaught Error: Template parse errors: There is no directive with "exportAs" set to "ngModel" ("">First Name</label>
<input [(ngModel)]="firstName" name="firstName" id="firstName" type="text"
[ERROR ->]#firstname="ngModel" (change)="log(firstname)" class="form-control
</div><div class="form-grou"): ng:///AppModule/ContactFormComponent.html@3:79 Can't bind to 'ngModel'
since it isn't a known property of
答案 0 :(得分:1)
@NgModule({
declarations: [
AppComponent,
ContactFormComponent
],
imports: [
BrowserModule,
FormsModule
],