模板分析错误

时间:2017-08-18 11:03:23

标签: html5 angular angular-material angular-ngmodel angular-material2

我已导入所有必需的模块,但仍然面临此错误。

Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'md-select'.
1. If 'md-select' is an Angular component and it has 'ngModel' input, then 
verify that it is part of this module.
2. If 'md-select' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to 
the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' 
of this component.

1 个答案:

答案 0 :(得分:0)

检查您是否包含 BrowserModule,MaterialModule,FormsModule

import {FormsModule} from '@angular/forms';
@NgModule({
  imports: [
    BrowserModule,
    MaterialModule.forRoot(),
    FormsModule
  ],
  declarations: [AppComponent],
  entryComponents: [AppComponent],
})