I have a MaterialModule
import { NgModule } from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {MatIconModule} from '@angular/material/icon';
@NgModule({
declarations: [],
imports: [
MatButtonModule,
MatIconModule
]
})
export class MaterialModule { }
And I import this module in my App Module
Then in app.component.html I try to use the mat-icon component
<button mat-button>
<mat-icon>face</mat-icon>
Click me!
</button>
but always get this error
Any idea please?
Thanks
You have to export both MatButtonModule and MatIconModule in your MaterialModule
import { NgModule } from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {MatIconModule} from '@angular/material/icon';
@NgModule({
declarations: [],
imports: [
MatButtonModule,
MatIconModule
],
exports: [
MatButtonModule,
MatIconModule
]
})
export class MaterialModule { }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.