https://johnpapa.net/angular-9-lazy-loading-components/
async getLazy1() {
this.viewContainerRef.clear();
const { Lazy1Component } = await import('./lazy1.component');
const compFactory= this.cfr.resolveComponentFactory(Lazy1Component)
this.viewContainerRef.createComponent(compFactory);
}
constructor(
private viewContainerRef: ViewContainerRef,
private cfr: ComponentFactoryResolver
) {}
ngOnInit() {
const componentFactorya = this.cfr.resolveComponentFactory(Lazy2aComponent);
const componentFactoryb = this.cfr.resolveComponentFactory(Lazy2bComponent);
this.viewContainerRef.createComponent(componentFactorya);
this.viewContainerRef.createComponent(componentFactoryb);
}