Material icon not rendering properly

dhana picture dhana · Oct 8, 2017 · Viewed 29.1k times · Source

Material icon not rendering properly in my project, i installed properly but even though not showing in browser.

i followed below steps:

npm install material-design-icons

.angular-cli.json

"styles": [
        "styles.css",
        "../node_modules/material-design-icons/iconfont/material-icons.css"
      ],

app.module.ts

import {MatSidenavModule, MatToolbarModule, MatIconModule} from '@angular/material';

app.component.html

<mat-toolbar-row>
    <span>Second Line</span>
    <span class="example-spacer"></span>
    <mat-icon class="example-icon">verified_user</mat-icon>
  </mat-toolbar-row>

Answer

Chris Fremgen picture Chris Fremgen · Apr 19, 2018

I had the same issue. Caused because I was importing the material theme before the fonts in my theme.scss.

Should be:

@import url( 'https://fonts.googleapis.com/css?family=Roboto:400,700|Material+Icons');

@import '~@angular/material/theming';