Angularjs4.0如何进行双向数据绑定
本帖最后由 幽梦林子 于 2017-7-15 19:58 编辑Angularjs4.0如何进行双向数据绑定呢?具体方法如下:
<input[(ngModel)]="inputValue">
注意引入:FormsModule
import { FormsModule } from '@angular/forms';
@NgModule({
declarations: [
AppComponent,
HeaderComponent,
FooterComponent,
NewsComponent
],
imports: [
BrowserModule,
FormsModule
],
providers: [],
bootstrap:
})
export class AppModule { }
使用:
<input type="text"[(ngModel)]="inputValue"/>
{{inputValue}}
页:
[1]