角度材质图标不起作用

问题描述:

我已经为 angular 安装了 Material,

I've installed Material for angular,

我已经在我的应用程序模块中导入了 MatIconModule(使用 import { MatIconModule } from '@angular/material/icon';)

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

我已经在我的 ngmodule 导入下添加了它:

I've added it under my ngmodule imports with:

@NgModule({
    imports: [ 
//...
MatIconModule, 
//...

我已经导入了所有样式表

I've imported all stylesheets

而且我还在我的应用程序组件中导入了它,该组件实际上(试图)使用它们(使用另一个 import {MatIconModule} from '@angular/material/icon'; 行在开头).

And I've also imported it in my app component that is actually (trying to) using them (with another import {MatIconModule} from '@angular/material/icon'; line at the beginning of it).

但是素材图标还是没有出现.

But material icons still not appear.

例如,使用这一行:

<button mat-icon-button (click)="snav.toggle()"><mat-icon>menu</mat-icon></button>

我期待这样的事情:

但我明白了:

有什么建议吗?

为 Material Icons 添加 CSS 样式表!

Add CSS stylesheet for Material Icons!

将以下内容添加到您的 index.html:

Add the following to your index.html:

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

参考 - https://github.com/angular/material2/issues/7948