Angular-由模块AppModule导入的意外值MatDialog [英] Angular - Unexpected value MatDialog imported by the module AppModule
本文介绍了Angular-由模块AppModule导入的意外值MatDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将Angular Material集成到Angular中,但出现以下错误.该程序已成功编译,但在浏览器中出现了此问题.
I am trying to integrate Angular Material in Angular but getting following error. The program is compiled successfully but getting this issue in browser.
Uncaught Error: Unexpected value 'MatDialog' imported by the module 'AppModule'. Please add a @NgModule annotation.
at syntaxError (compiler.js:485)
at eval (compiler.js:15226)
at Array.forEach (<anonymous>)
at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15201)
at JitCompiler._loadModules (compiler.js:34385)
at JitCompiler._compileModuleAndComponents (compiler.js:34346)
at JitCompiler.compileModuleAsync (compiler.js:34240)
at CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:239)
at PlatformRef.bootstrapModule (core.js:5551)
at eval (main.ts:11)
推荐答案
您应该改为导入MatDialogModule
.
@NgModule({
imports: [
...,
MatDialogModule
]
...
})
export class AppModule {}
也不要忘记在选择器中角材料已从md
移到mat
.
Also don't forget that angular material has moved from md
to mat
in selectors.
这篇关于Angular-由模块AppModule导入的意外值MatDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文