如何在Angular2中的标记/元素名称中使用插值

时间:2017-02-03 11:26:08

标签: angular typescript interpolation

*ngFor内动态生成组件选择器时,我在元素名称中使用插值字符串时遇到问题。以下是我的代码:

<span *ngFor="let platform of platforms">
    <app-{{platform}}-share></app-{{platform}}-share>
</span>

在我的组件中,我已将platforms属性声明为:

platforms = ["one","two","three"].

基于此我想动态加载组件,如: <app-one-share></app-one-share>里面的for循环内部视图。有什么我想念的东西。我收到错误

'app-{{platform}}-share' is not a known element:

为什么不评估插值?

0 个答案:

没有答案