【发布时间】:2017-03-12 20:26:46
【问题描述】:
我正在尝试使用 angular material design (2.0.0-beta2),但我无法让它工作。例如,如果我尝试使用
<md-input-container>
<input mdInput name="value">
</md-input-container>
将以下内容添加到app.module.ts
import {MaterialModule} from '@angular/material';
@NgModule({
...
imports: [ MaterialModule, ...],
...
})
但我收到以下错误:
'md-input-container' is not a known element:
注意:使用上述代码的组件在我的应用程序中的某个地方存在几个模块!
当我还将MdInputContainer 添加到声明时,我得到一个不同的错误:
Type MdInputContainer is part of the declarations of 2 modules: MdInputModule and AppModule!
我想我已经接近了,但我错过了一些东西,任何帮助将不胜感激
【问题讨论】:
-
如果你想使用来自更深模块的材料,只需将其导入该模块即可。
-
您不需要添加声明数组。只需准确导入特定模块即可。
标签: javascript angular material-design angular-material