简体   繁体   English

Angular - 模块AppModule导入的意外值MatDialog

[英]Angular - Unexpected value MatDialog imported by the module AppModule

I am trying to integrate Angular Material in Angular but getting following error. 我试图在Angular中集成Angular Material但是会出现以下错误。 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)

You should import MatDialogModule instead. 您应该导入MatDialogModule

@NgModule({
  imports: [
    ...,
    MatDialogModule 
  ]
  ...
})
export class AppModule {}

Also don't forget that angular material has moved from md to mat in selectors. 另外,不要忘记角度材料在选择器中已从md移动到mat

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 模块“AppModule”在语法错误处导入的意外值“未定义” - Unexpected value 'undefined' imported by the module 'AppModule' at syntaxError 模块“AppModule”错误导入的意外值“AngularFirestoreDocument” - Unexpected value 'AngularFirestoreDocument' imported by the module 'AppModule' error Angular 2模块“ AppModule”声明的异常值“ MyDirective” - Angular 2 Unexpected value 'MyDirective' declared by the module 'AppModule' 由模块“AppModule”导入的意外值“FormBuilder”。 请添加@NgModule 注释 - Unexpected value 'FormBuilder' imported by the module 'AppModule'. Please add a @NgModule annotation Angular 2 发布“模块导入的意外值‘ElementRef’” - Angular 2 Release "Unexpected value 'ElementRef' imported by the module" AppModule 中导入的共享模块 - Shared module imported in AppModule 模块“ AppModule”声明的异常值“ Component” - Unexpected value 'Component' declared by the module 'AppModule' 模块“ AppModule”声明了意外的模块“ PublicModule”。 Angular4组件结构 - Unexpected module 'PublicModule' declared by the module 'AppModule'. Angular4 Component Structure 未捕获的错误:模块&#39;AppModule&#39;导入了意外的指令&#39;ProductsComponent&#39;。 请添加@NgModule批注 - Uncaught Error: Unexpected directive 'ProductsComponent' imported by the module 'AppModule'. Please add a @NgModule annotation 角度“由模块导入的意外管道”错误 - Angular 'unexpected pipe imported by module' error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM