This is for the 2.1.0 Final release versions of Angular.
I\'m trying to dynamically instantiate a component who\'s type is passed from a config JSON file. The best t
My solution for now is to do what I really wanted to avoid, which is maintaining a key/val registry.
let componentRegistry = {
'SomeComp1': SomeComp1,
'SomeComp2': SomeComp2
}
And then call it with:
private renderComponent(config:any) {
let configComponents = config.components;
if(config.hasOwnProperty('components') && configComponents.length){
for(let i = 0, len = configComponents.length; i < len; i++){
let comp = configComponents[i];
this.componentResolver.resolveComponentFactory(this.componentRegistry[comp]);
}
}
}