Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error retrieving icon: Unable to find icon with the name ":done"

This is my first time using Angular Material, I am having an issue with mat-icons.

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

In my shared module, I have the icons imported:

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 { }

then I import the SharedModule into my 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 { }

finally I go to use the mat-icon in the view:

<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>

Hover with this I get the following error: Error retrieving icon: Unable to find icon with the name ":done"

I am by no means new to Angular, but definately new to Angular Material, so not to sure what is happening here. What I have above should be working. Thoughts?

like image 253
Sandra Willford Avatar asked Aug 26 '18 21:08

Sandra Willford


1 Answers

This is how you should use the mat-icon component

<mat-icon>done</mat-icon>
like image 183
Ploppy Avatar answered Oct 06 '22 02:10

Ploppy