Skip to content

Instantly share code, notes, and snippets.

@coderkan
Created March 15, 2020 18:02
Show Gist options
  • Save coderkan/fe06d523b03511a0bc8480c445c73c65 to your computer and use it in GitHub Desktop.
Save coderkan/fe06d523b03511a0bc8480c445c73c65 to your computer and use it in GitHub Desktop.
loadDynamicComponentsWithIndex(ind: any) {
const frameworkItem = this.frameworks[ind];
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(frameworkItem.component);
const viewContainerRef = this.frameworkHost.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(componentFactory);
(<FrameworkComponent>componentRef.instance).data = frameworkItem.data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment