在 angular 6 inside index.html 中使用超棒的字体图标

Using font-awesome icons in angular 6 inside index.html

我已经成功地向我的 andular 6 项目添加了一个加载器,它将在初始加载时显示加载器,直到应用程序完全加载。然而,我似乎无法在微调器中加载一个很棒的字体图标。

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
import { fab } from '@fortawesome/free-brands-svg-icons';

import { AppComponent } from './app.component';

library.add(fab);

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FontAwesomeModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

src/index.html

<body>
  <abe-root>

    <div class="app-loading">
      <div class="logo"><fa-icon [icon]="['fab', 'angular']"></fa-icon></div>
      <svg class="spinner" viewBox="25 25 50 50">
        <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"/>
      </svg>
    </div>

  </abe-root>
</body>

它没有错误,或者只是没有显示图标?我是 angular 的新手,所以我可能做错了一些事情。

这行不通

  <div class="logo"><fa-icon [icon]="['fab', 'angular']"></fa-icon></div>

因为还没有应用上下文。

您可以像这样显示 FA 字体,没有 angular 个组件(还)

<i class="fa fa-angular"></i>

我还假设您在 index.html 头部部分包含了 FA CSS。