首页 > 解决方案 > Some material icon doesn't show in production

问题描述

I don't know why but only in production some material icon doesn't appear, as you can see from the image the first icon is missing:

enter image description here

here's the code:

 <mat-nav-list>
   <a mat-list-item routerLink="/dashboard" matTooltip="dashboard">
     <mat-icon matListIcon>bar_chart</mat-icon>
   </a>
   <a mat-list-item (click)="routeToContacts()" matTooltip="contacts">
     <mat-icon matListIcon>people</mat-icon>
   </a>

标签: angularangular-material

解决方案


You need to insert style into the project:

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

If it did not solve the problem, please try to add the code below in your style.css (or style.scss) :

md-icon{
  font-family: 'Material Icons' !important;
}

推荐阅读