小编Mat*_*ano的帖子

带角度的 Ionicons 版本 5

如何将 ionicons 版本 5 添加到 Angular,版本 4.5 有一个 scss 可用,我可以以这种方式使用,但现在在版本 5 ionicons 使用 svgs 并且不知道如何将其与 Angular 集成。

目前的方法在 angular.json 中

"styles": [
              "./node_modules/ionicons/dist/scss/ionicons.scss",
              "src/app/theme/styles/styles.scss"
            ],
Run Code Online (Sandbox Code Playgroud)

然后在我的 app.component.ts 中(我使用的是 nebular UI) https://akveo.github.io/nebular/docs/guides/register-icon-pack#register-icon-pack

export class AppComponent implements OnInit {

  constructor(private iconsLibrary: NbIconLibraries, public store$: Store<any>, ) {
    iconsLibrary.registerFontPack('ion', { iconClassPrefix: 'ion' });
    iconsLibrary.registerFontPack('nebular', { iconClassPrefix: 'nb' });
    iconsLibrary.setDefaultPack('nebular');
    // @ts-ignore
    if (window.Cypress) {
      // @ts-ignore
      window.__appStore__ = store$;
    }
  }

  ngOnInit() {
  }
}
Run Code Online (Sandbox Code Playgroud)

我在问题中看到,对于带有角度的离子,它们添加

"assets": [
              {
                "glob": "**/*",
                "input": "src/assets", …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionicons angular nebular

6
推荐指数
1
解决办法
5490
查看次数

标签 统计

angular ×1

ionic-framework ×1

ionicons ×1

nebular ×1