0
votes

After installing Angular Material , whenever I import anything form @angular/material I get this error

error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

I tried deleting node_modules and redownloading using npm install . tried to reinstall Angular Material ,still I get the same error over and over

1

1 Answers

1
votes

You cannot implement angular material using '@angular/material' imports

You have to import the required module that you are going to use in the project like if using Material button then import the using import { MatButtonModule } from '@angular/material/button'; and then add it in imports array like MatButtonModule


import { MatButtonModule } from '@angular/material/button';


@NgModule({
  declarations: [AppComponent,
  imports: [
      MatButtonModule 
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

This would work