I'm facing an issue with my Angular 9 project where I'm trying to integrate the Material library. Despite my efforts, none of the elements are displaying and I keep encountering this error:
core.js:14613 'mat-icon' is not a known element:
1. If 'mat-icon' is an Angular component, then verify that it is part of this module.
2. If 'mat-icon' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
I've tried adjusting dependencies versions and importing all necessary modules, but no luck so far. Any assistance would be highly appreciated!
Below is a snippet from my app.module:
import { APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
// other imports...
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
CommonModule,
MatButtonModule,
MatProgressSpinnerModule,
// more imports...
],
exports: [],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
providers: [
AppConfigService,
{
provide: APP_INITIALIZER,
useFactory: AppInitializer,
multi: true,
deps: [AppConfigService]
},
FormBuilder,
FormsModule,
],
bootstrap: [AppComponent]
})
export class AppModule { }
Here are some dependency versions from my package.json:
"@angular/animations": "^9.1.0",
"@angular/cdk": "^9.2.0",
"@angular/common": "^9.1.0",
"@angular/compiler": "^9.1.0",
"@angular/core": "^9.1.0",
"@angular/forms": "^9.1.0",
"@angular/material": "^9.2.0",
// other dependencies...