Angular2 Import组件基于Id

时间:2016-07-26 13:47:14

标签: angular angular2-template angular2-directives

我需要根据后端响应决定需要显示哪些组件。

例如:我从后端得到此回复

{ plugin: 
    { 
      id = 'inputfieldWidgetV12' 
    }
  data: {
     value = 'helloWorld'
  }
}

基于此我需要显示一个组件inputfieldWidgetV12.ts,并将数据传递给它的构造函数:{value =' helloWorld'}。

如何在实施过程中注入我不知道的组件?

我尝试过require(plugin.id),但它没有用。

0 个答案:

没有答案