Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No provider for ComponentLoaderFactory

Tags:

angular

I updated my angular2 project and before it was working fine. However now I am getting the following error:

Error: Uncaught (in promise): Error: Error in ./RibbonComponent class 
RibbonComponent - inline template:4:5 caused by: No provider for 
ComponentLoaderFactory!
Error: Error in ./RibbonComponent class RibbonComponent - inline 
template:4:5 caused by: No provider for ComponentLoaderFactory!

ComponentLoaderFactory

export declare class ComponentLoaderFactory {
    private _componentFactoryResolver;
    private _ngZone;
    private _injector;
    private _posService;
    constructor(componentFactoryResolver: ComponentFactoryResolver, ngZone: NgZone, injector: Injector, posService: PositioningService);
    /**
     *
     * @param _elementRef
     * @param _viewContainerRef
     * @param _renderer
     * @returns {ComponentLoader}
     */
    createLoader<T>(_elementRef: ElementRef, _viewContainerRef: ViewContainerRef, _renderer: Renderer): ComponentLoader<T>;
}

I am not sure what else to post. All my made my package.json up to date via ncu than ncu -u. I am being to think I found a bug. I did find a post on GitHub but it did not help. GitHub

If I need to post anything else let me know.

like image 905
Mike3355 Avatar asked Jan 19 '17 18:01

Mike3355


2 Answers

Not sure what libraries you are using, but I had this error when using ng2-bootstrap.

I got the solution from this page: angular-2-with-ng2-bootstrap-and-karma-testing-final-adventure.

Essentially the problem was with an import that required the .forRoot() method to be called. Maybe look for something similar in the RibbonComponent or other imported library.

like image 192
Richard Matsen Avatar answered Oct 06 '22 21:10

Richard Matsen


for example is you are using modal of ngx-bootstrap then you should import the module in spec.ts like :-

ModalModule.forRoot()

Hope this helps

like image 25
Alok Kamboj Avatar answered Oct 06 '22 22:10

Alok Kamboj