Cannot read property 'html' of undefined
See original GitHub issueI’m getting the follow error:
ERROR TypeError: Cannot read property 'html' of undefined
at FaIconComponent.ngOnChanges (angular-fontawesome.es5.js:106)
// @TODO: make sure that it doesn't break things to do html[0] here.
this.renderedIconHTML = this.sanitizer.bypassSecurityTrustHtml(renderedIcon.html[0]);
app.module
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
imports: [
...
FontAwesomeModule
],
component.html
<fa-icon [icon]="faUser"></fa-icon>
package.json
"@angular": "^5.2.0",
"@fortawesome/angular-fontawesome": "0.1.0-3",
"@fortawesome/fontawesome": "^1.1.3",
"@fortawesome/fontawesome-free-solid": "^5.0.6",
What could I be missing?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Cannot read property 'html' of undefined after jest update
In my package.json there is no jest-environment-jsdom . But I noticed that I have many outdated packages. If updating them fixes it, I'll...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong...
Read more >[Solved] Cannot read Properties of Undefined in JavaScript
The "Cannot read properties of undefined" error occurs when you try to access a property or a method on a variable that stores...
Read more >Cannot read property 'html' of undefined · Issue #114 - GitHub
I am having the same problem with ngx-summernote v0.7.4 . I found a solution by adding this line in node_modules/ngx-summernote/fesm5/ngx- ...
Read more >Cannot read property 'html' of undefined after jest update ...
I had this same issue and noticed that jest-environment-jsdom was on version 27. I installed v28 to match the jest version and it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m working on adding something to the example in the repo that will clarify how to reference icons with non-default prefixes.
As for your workaround, while that may work, it is essentially avoiding the Angular component and instead relying on our
autoReplaceSvg
functionality to translate<i>
tags into<svg>
. If you’re satisfied with that, great. But you may find it more performant (including having smaller bundle size) to import only those icons that you intend to use and add them to the library, or make them available as objects to your templates.I’d like to leave this issue open for the moment, because I do want to fix the error handling problem you stumbled onto here.
@mlwilkerson you da man 💯