We can dynamically loading component at runtime using
dynamic component resolver.
In below code, we are rendering form or listing page dynamically based on input parameter.
componentData-->input parameterIt tells which component to load
var entity = {
form: DynamicFormComponent ,
list:DynamicListComponent
};
var componentName= entity[data.component]
We pass a string, though the json object it points to the correct component
this.dynamicComponentContainer.insert(component.hostView);This put the content of the component html in the
<div #dynamicComponentContainer>
</div>
Comments
Post a Comment