Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - Unexpected value MatDialog imported by the module AppModule

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)
like image 916
D555 Avatar asked Jan 15 '18 14:01

D555


1 Answers

You should import MatDialogModule instead.

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

Also don't forget that angular material has moved from md to mat in selectors.

like image 89
yurzui Avatar answered Nov 15 '22 22:11

yurzui