文章内容

2017/11/15 21:55:56,作 者: 黄兵

Can't bind to 'ngModel' since it isn't a known property of 'input'.

今天在学习Angular 2的时候,实例报错了,如下:

Can't bind to 'ngModel' since it isn't a known property of 'input'. 

解决方案:

app.module.ts下面增加如下内容:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {FormsModule} from "@angular/forms";


import { AppComponent } from './app.component';


@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

参考资料:

Can't bind to 'ngModel' since it isn't a known property of 'input'

黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - Can't bind to 'ngModel' since it isn't a known property of 'input'. 

分享到:

发表评论

评论列表