小编Har*_*evu的帖子

要允许任何元素将"NO_ERRORS_SCHEMA"添加到此组件的"@NgModule.schemas".在Angular 4中

我用angular-cli(ng new my-project-name)创建了一个新项目

当我运行npm run test它运行没有任何失败.

我在项目中添加了font-awsome模块(https://www.npmjs.com/package/angular-font-awesome)来显示字体图标.

在我的html文件中添加了<fa name="bars"></fa>标签并获得了预期的输出.如果我npm run test再次运行,它将以3个失败结束,所有失败都是针对fa标记.

这是样本失败报告

'fa' is not a known element:
        1. If 'fa' is an Angular component, then verify that it is part of this module.
        2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("--The content below is only a placeholder and can be replaced.-->
        <div style="text-align:center">          [ERROR ->]<fa name="bars"></fa>
          <h1>            Welcome to {{title}}!
        "): …
Run Code Online (Sandbox Code Playgroud)

font-awesome typescript angular

16
推荐指数
3
解决办法
5万
查看次数

标签 统计

angular ×1

font-awesome ×1

typescript ×1