Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComponentLoaderComponent: createComponent of undefined #79

Open
faradoxuz opened this issue Nov 22, 2019 · 2 comments
Open

ComponentLoaderComponent: createComponent of undefined #79

faradoxuz opened this issue Nov 22, 2019 · 2 comments

Comments

@faradoxuz
Copy link

Please, move this

const factory = this._factoryResolver.resolveComponentFactory(this.class_component);
        this.componentRef = this.viewContainerRef.createComponent(factory);

        // then give some data
        this.setComponentData(this.data);

to ngOnAfterInit
because it is not working in ngOnInit

@TwanoO67
Copy link
Owner

Hello,

Which version are you using ?
Do you have a plunkr where I can see your example ?

@faradoxuz
Copy link
Author

faradoxuz commented Nov 22, 2019

I am using ngx-admin-lte": "^3.0.0-beta.1
Angular 8.
I do not know how to use plunker.
When I am doing

private mylinks: any = [ { class: MenuWidgetComponent, data: { label: 'Home', icon: 'user', url: '/' } }, ]
it throws error
ERROR TypeError: Cannot read property 'createComponent' of undefined at ComponentLoaderComponent.ngOnInit (ngx-admin-lte.js:998) at checkAndUpdateDirectiveInline (core.js:31910) at checkAndUpdateNodeInline (core.js:44367) at checkAndUpdateNode (core.js:44306) at debugCheckAndUpdateNode (core.js:45328) at debugCheckDirectivesFn (core.js:45271) at Object.eval [as updateDirectives] (MenuAsideComponent.html:40) at Object.debugUpdateDirectives [as updateDirectives] (core.js:45259) at checkAndUpdateView (core.js:44271) at callViewAction (core.js:44637)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants