Angular Material icons not working

前端 未结 14 2204
走了就别回头了
走了就别回头了 2020-12-23 20:27

I\'ve installed Material for angular,

I\'ve imported on my app module MatIconModule (with import { MatIconModule } from \'@angular/material/icon\';)

14条回答
  •  再見小時候
    2020-12-23 20:45

    The full solution can be :

    Step one

    You have to import MatIconModule in your project, in my project I import the necessary component in a separate file then I import it in the AppModule, you can use this or import them directly :

    import { NgModule } from "@angular/core";
    import { MatButtonModule } from '@angular/material';
    import { MatIconModule } from '@angular/material/icon';
    
    @NgModule({
        imports: [MatIconModule, MatButtonModule], // note the imports 
        exports: [MatIconModule, MatButtonModule], // and the exports
    })
    export class MaterialModule { }
    

    Step two

    Load the icon font in your index.html :

    
    

提交回复
热议问题