检索图标时出错:找不到名称为“:done”的图标

时间:2018-08-26 21:33:59

标签: angular angular-material

这是我第一次使用Angular Material,但是Mat-icons出现了问题。

我的index.html具有: <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

在共享模块中,我导入了图标:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {
    MatButtonModule,
    MatCardModule,
    MatIconModule,
    MatMenuModule,
    MatToolbarModule,
} from '@angular/material';

@NgModule({
    imports: [
        CommonModule,
        MatButtonModule,
        MatCardModule,
        MatIconModule,
        MatMenuModule,
        MatToolbarModule
    ],
    exports: [
        MatButtonModule,
        MatCardModule,
        MatIconModule,
        MatMenuModule,
        MatToolbarModule
    ],
    declarations: []
})
export class SharedModule { }

然后将SharedModule导入我的LoginModule:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../../shared/shared.module';
import { LoginRoutingModule } from './login.routing.module';
import { LoginContainerComponent } from './login-container/login-container.component';
import { LoginViewComponent } from './login-view/login-view.component';

@NgModule({
    imports: [
        CommonModule,
        LoginRoutingModule,
        SharedModule
    ],
    declarations: [
        LoginContainerComponent,
        LoginViewComponent
    ]
})

export class LoginModule { }

最后我要在视图中使用mat-icon:

<mat-card>
    <mat-card-title-group>
        <mat-card-title>
            Welcome to Track-It
        </mat-card-title>
        <mat-card-subtitle>
            In order to use all of Track-it's goodness, please login...
        </mat-card-subtitle>
    </mat-card-title-group>
    <mat-card-content>
        Lorem, ipsum dolor sit amet consectetur adipisicing elit. Maxime quod labore autem. Sunt expedita ullam quis in deserunt rem eum, quas culpa quo aut eius consequuntur magni. Voluptates, mollitia ullam.
    </mat-card-content>
    <mat-card-actions [align]="'end'">
        <button mat-flat-button>
            Login&nbsp;
            <mat-icon svgIcon="done"></mat-icon>
        </button>
    </mat-card-actions>
</mat-card>

悬停与此,我得到以下错误: Error retrieving icon: Unable to find icon with the name ":done"

我绝不是Angular的新手,但绝对不是Angular Material的新手,所以不确定这里发生了什么。我上面有什么应该工作。有想法吗?

1 个答案:

答案 0 :(得分:2)

这就是使用using UnityEngine; public class ObstacleScrolling : MonoBehaviour { /* * * A script which controls the movement of the Obstacles to make it look like the player is running towards them. * Attached to: [All Obstacles in the Prefabs folder] * Scene: Level0 * */ private Rigidbody2D rb2d; public float scrollSpeed; public float test; GameObject canvasObj; Canvas canvas; // Use this for initialization void Start() { rb2d = GetComponent<Rigidbody2D>(); canvasObj = GameObject.Find("Canvas"); canvas = canvasObj.GetComponent<Canvas>(); test = -1280 * canvas.scaleFactor; scrollSpeed = scrollSpeed * canvas.scaleFactor; //+ -(Time.timeSinceLevelLoad / 100); } // Update is called once per frame void FixedUpdate() { this.transform.Translate(Vector3.right * GameControl.speed); if (GameControl.instance.gameOver == true) { rb2d.velocity = Vector2.zero; } } } 组件的方式

mat-icon