Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import("path-to-module/hello.module.js").then((module: any) => {
- this.compiler.compileModuleAndAllComponentsAsync(module.HelloModule)
- .then((compiled) => {
- const helloModule = compiled.ngModuleFactory.create(this.injector);
- const componentFactory = compiled.componentFactories.find((factory: ComponentFactory<any>) => {
- return factory.componentType.name === "HelloMainComponent";
- });
- const helloComponent: ComponentRef<any> =
- componentFactory.create(this.injector, [], null, helloModule);
- helloComponent.instance.lazyLoaded = true;
- helloComponent.instance.inputProp = "hello world"
- this.container.insert(helloComponent.hostView); // ViewContainerRef
- this.cd.markForCheck();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement