How to dynamic import components and render them using ivy

Viewed 310

Im trying to import a component or module or application, pretty much doesnt matter which, into a 2nd app, and render that component using Angular 8 ivy new function

public someFunction(): void {
    import('someComponent).then(({ lalala }) => {
      const cmpFactoy = this.cmpFacRes.resolveComponentFactory(lalala);

      this.vCntRef.createComponent(cmpFactoy);
    });
  }

i can see, with the import someComponent that a file is loaded at runtime in my Browser. It includes all the Modules data. But the callback Object (lalala) is always empty. Thats when i run into an error... Cannot read property 'ngComponentDef' of undefined. I would expect the Module the be in the object so it can be created with the createComponent Function.

Maybe i compiled the component wrong im trying to import?

Maybe one of you has tryed this out already and can give me some pointers.

I'd realy appreciate the help.

0 Answers
Related