FortAwesome / angular-fontawesome

Official Angular component for Font Awesome 5+
https://fontawesome.com
MIT License
1.49k stars 152 forks source link

Doesn't work in Angular 9 #229

Closed maxisam closed 4 years ago

maxisam commented 4 years ago

Describe the problem

ERROR TypeError: Cannot read property 'get' of undefined at NgModuleRef$1.get (core.js:35567) at Object.get (core.js:33358) at getOrCreateInjectable (core.js:5470) at Module.ɵɵdirectiveInject (core.js:20777) at NodeInjectorFactory.FaIconComponent_Factory [as factory] (angular-fontawesome.js:259) at getNodeInjectable (core.js:5615) at instantiateAllDirectives (core.js:12662) at createDirectivesInstances (core.js:11898) at ɵɵelementStart (core.js:20961) at Module.ɵɵelement (core.js:21017)

This is the line related to fontawesome

FaIconComponent.ɵfac = function FaIconComponent_Factory(t) { return new (t || FaIconComponent)(ɵngcc0.ɵɵdirectiveInject(ɵngcc1.DomSanitizer), ɵngcc0.ɵɵdirectiveInject(FaConfig), ɵngcc0.ɵɵdirectiveInject(FaIconLibrary), ɵngcc0.ɵɵdirectiveInject(FaStackItemSizeDirective, 8)); };

somehow it throws an error like this. But I tested it with other projects, everything works fine.

It seems like it only happens in certain situation.

I just wanna put this out here to see if anyone have the same issue.

maxisam commented 4 years ago

Just figured out. It has something to do with the module loading timing.