错误TypeError:无法读取未定义的属性“ html”(角字体)

演员

我想在我的Angular项目中使用fontawesome。我想试用FortAwesome / angular-fontawesome,但是如果尝试使用图标,则会在浏览器控制台中出现错误:

ERROR TypeError: Cannot read property 'html' of undefined
    at FaIconComponent.ngOnChanges (webpack-internal:///../../../../@fortawesome/angular-fontawesome/@fortawesome/angular-fontawesome.es5.js:112)
    at checkAndUpdateDirectiveInline (webpack-internal:///../../../core/esm5/core.js:12576)
    at checkAndUpdateNodeInline (webpack-internal:///../../../core/esm5/core.js:14104)
    at checkAndUpdateNode (webpack-internal:///../../../core/esm5/core.js:14047)
    at debugCheckAndUpdateNode (webpack-internal:///../../../core/esm5/core.js:14940)
    at debugCheckDirectivesFn (webpack-internal:///../../../core/esm5/core.js:14881)
    at Object.eval [as updateDirectives] (ng:///AppModule/AppComponent.ngfactory.js:154)
    at Object.debugUpdateDirectives [as updateDirectives] (webpack-internal:///../../../core/esm5/core.js:14866)
    at checkAndUpdateView (webpack-internal:///../../../core/esm5/core.js:14013)
    at callViewAction (webpack-internal:///../../../core/esm5/core.js:14364)

我安装@fortawesome/angular-fontawesome了两个依赖项(@fortawesome/fontawesome-free-solid@fortawesome/fontawesome-free-brandsnpm

我将其导入app.module.ts,并将其添加到imports

import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';

我在安装过程中错过了什么吗?当我使用启动应用程序时,在终端上没有错误ng serve --open,我只在浏览器控制台中得到了错误。

内特

我遇到了同样的错误,只是意识到我的模板值与组件名称不匹配。

<button type="button" class="btn btn-default">
  <fa-icon [icon]="caretLeft"></fa-icon>
</button>

在组件中,我有

private faCaretLeft = faCaretLeft;

这是一个菜鸟错误,源于我为解决以前的错误而进行的重命名。当我将图标绑定更改为正确的名称时,该错误已解决。

<button type="button" class="btn btn-default">
  <fa-icon [icon]="faCaretLeft"></fa-icon>
</button>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

角反应形式错误| 错误TypeError:无法读取未定义的属性“有效”

角“ ERROR TypeError:无法读取未定义的属性”匹配“

角6:TypeError:无法读取未定义的属性“无效”?

角5:错误TypeError:无法读取未定义的属性'toLowerCase'

Anguler-ClientQuoteLandingComponent.html:74错误TypeError:无法读取未定义的属性“无效”

从剩余数据中输入角材料表-错误TypeError:无法读取未定义的属性“数据”

如何解决TrackingPage.html:24错误TypeError:无法读取未定义的属性“取消订阅”?

为什么Angular 5 Transition抛出AppComponent.html:2错误TypeError:无法读取未定义的属性'forEach'

角数组:错误类型错误:无法读取未定义的属性

角组件测试用例出现错误:类型错误:无法读取未定义的属性“ contractno”

角单元测试:TypeError:无法读取未定义的属性“ root”

角获取数组TypeError:无法读取未定义的属性“ 1”

角离子电容器构建产品:TypeError 无法读取未定义的“updateClassDeclaration”的属性

角生成-未捕获的TypeError:无法读取未定义的属性'id'

角材料自动完成显示TypeError:无法读取未定义的属性'createEmbeddedView'

TypeError:无法读取未定义的属性“ legend” 角+ ng2-图

角5-可观察到的返回错误无法读取未定义的属性

类型错误:无法读取未定义的属性“ 0” 角4

类型错误:无法读取未定义的属性“名称”。角 7

AppComponent.html:1 错误类型错误:无法读取未定义的属性“订阅”

未捕获的TypeError:无法读取未定义HTML的属性“样式”

角“无法读取未定义的属性'subscribe'”

角4:无法读取未定义的属性“ http”

角 | 无法读取未定义的属性“XXX”

角2:无法读取未定义的属性“验证器”

HTML5 视频:未捕获的类型错误:无法读取未定义的属性“0”

错误:“无法读取属性'nodename'的未定义”转换html表时

更新控制 html 的变量时无法读取未定义错误的属性“添加”

无法读取未定义的属性“目标”-HTML按钮