Android 显示角度组件v2或v4的列表
我需要显示ts文件中的角度组件列表。我能做什么Android 显示角度组件v2或v4的列表,android,angular,ionic-framework,components,Android,Angular,Ionic Framework,Components,我需要显示ts文件中的角度组件列表。我能做什么 // file ResolventePage.ts listFormulas: IFormula[] = [{ name: "Formula 1", description: "a description", element: AComponent1 }, { name: "Formula 2", description: "a description 2", element
// file ResolventePage.ts
listFormulas: IFormula[] = [{
name: "Formula 1",
description: "a description",
element: AComponent1
}, {
name: "Formula 2",
description: "a description 2",
element: AComponent2
}, ... ]
但我不知道如何在循环中动态放置它:
<ion-item *ngFor="let item of listFormulas">
<ion-label>{{ item.name }}</ion-label>
<!-- Here I need to render the component "item.element" -->
</ion-item>
{{item.name}
非常感谢您的帮助。如果我正确理解了您的
列表公式中的每个元素
,那么它就是和角度分量
选择1
首先导入.ts文件中的所有组件,例如:
从“/AComponent1”导入{AComponent1};
从“./AComponent2”导入{AComponent2};
// ...
然后试试这个快速破解:
{{item.name}
选择2
如果这不起作用,那么这里有一种适当但先进的方法来做到这一点。这是一个非常详细的官方文档的演示