Open Angelotas opened 2 years ago
Any solutions?
See here:
async load(): Promise<void> {
const m = await loadRemoteModule({
type: 'module',
remoteEntry: 'http://localhost:4201/remoteEntry.js',
exposedModule: './Component'
});
const ref = this.viewContainer.createComponent(m.MyTicketsComponent);
// const compInstance = ref.instance;
}
Using the example here, this works:
export class AppComponent {
title = 'shell';
@ViewChild('placeHolder', { read: ViewContainerRef })
viewContainer!: ViewContainerRef;
async load(): Promise<void> {
const component = await loadRemoteModule('users', './Component').then(
(m) => m.AppComponent
);
this.viewContainer.createComponent(component);
}
}
Is there any way to load lazy remote modules without loadChildren in RouterModule? I guess it's not possible to use
import('https://example.es/remoteEntry.js).then()
... andComponentFactoryResolver
. Do you know any solution?