2

我已经成功地在我的 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>

它没有错误或只是没有显示图标?我对角度相当陌生,所以我可能做错了。

4

1 回答 1

5

这行不通

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

因为还没有应用上下文。

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

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

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

于 2018-05-25T22:40:51.373 回答