角材料图标不起作用 [英] Angular Material icons not working

查看:58
本文介绍了角材料图标不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已为角"安装了材质",

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>

我期望这样的事情:

但是我明白了:

有什么建议吗?

推荐答案

为材质图标添加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

这篇关于角材料图标不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆