Reputation: 670
I've updated the Angular project from v8 to v9 and followed all the required updates but running ng serve
throws material errors. I've imported all material components individually instead of importing directly from @angular/material
and included all these in separate file material.module.ts
. This file is imported in app.module.ts
but still Angular is not detecting any material components and throwing below errors:
Note:
I've tried almost all available solutions and asking this question after no success.
Upvotes: 0
Views: 882
Reputation: 713
The real problem with your project is included all these in separate file material.module.ts . From Angular 9+, you should explicitly declare which Material Modules are imported instead of creating one shared module. I have resolved a problem before by refactoring most of own modules. Step by step here is:
Shared Material Module
@NgModule({
imports: [
MatToolbarModule
]
})
export class OwnModule { }
I know it is very painful but we don't have any choice to upgrade Angular 9+.
Upvotes: 3