简体   繁体   中英

nebular with material-icon are not shown icons

I follow the documentation and configure the ligature font pack documentation icon

  constructor(
  private _iconLibraries: NbIconLibraries
 ) {
  this._iconLibraries.registerFontPack('material-icons', {
   ligature: true,
  });

in my app.module.ts I have the imports like this

 imports: [
  NbEvaIconsModule,
  NbIconModule,
  MatIconModule,
  ...
 ]

And i have this in my component:

 <nb-icon icon="star"></nb-icon>
 <nb-icon icon="group" pack="material-icons"></nb-icon>
 <nb-icon icon="star"></nb-icon>
 <mat-icon>group</mat-icon>
 <nb-icon icon="star"></nb-icon>

The "star" icons are showed without problems, the "group" in the mat-icon is showed too, but the "group" inside nb-icon is shown as "group" text, no icon.

在此处输入图像描述

And in the package.json i have this:

"@angular/material": "~13.1.0",
"@nebular/eva-icons": "9.0.0",
"@nebular/theme": "^9.0.0",
"eva-icons": "^1.1.2",
"material-design-icons": "^3.0.1",
"nebular-icons": "^1.1.0",

Am I doing something wrong?

https://github.com/akveo/nebular/issues/2554

Seems the Nebular documentation didn't document well; and has been bugged fixed as well. Just follow its example without CustomNbIconLibraries as long you running on v9 Nebular Theme.

export class AppModule {
  constructor(private iconLibraries: NbIconLibraries) {
    this.registerMaterialIcons();
  }

  private registerMaterialIcons() {
    this.iconLibraries.registerFontPack("material-icons", {
      packClass: "material-icons",
      ligature: true
    });
    this.iconLibraries.setDefaultPack("material-icons");
  }
}

in your index.html import

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM