ngModel抛出异常,这在rc4中工作正常
<input [(ngModel)]="par.name" placeholder="name" />
这些是例外:
zone.js@0.6.12?main=browser:260 Uncaught EXCEPTION: Error in
./CommunityListComponent class CommunityListComponent – inline
template:10:27 ORIGINAL EXCEPTION: No value accessor for form control
with unspecified name ORIGINAL STACKTRACE: Error: No value accessor
for form control with unspecified name
也可以通过将FormsModule导入到引导程序模块中来解决,然后它将可供所有组件使用.
原文链接:/angularjs/141015.htmlimport { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { AppComponent } from 'app/components/app'; @NgModule({ imports: [BrowserModule,FormsModule],declarations: [AppComponent],bootstrap: [AppComponent] }) export class AppModule { }