我的问题是,根据我需要多少个数组项,需要多少个选项卡。因此,如果我的阵列像狗,猫,老鼠一样-我需要3个以dog cat mouse命名的标签。如果我只有猫和狗,那么只有2个名为“猫和狗”的标签。希望大家都明白我的意思。感谢您的帮助!
答案 0 :(得分:1)
只需遍历选项卡数组:
<ion-tabs>
<ion-tab *ngFor="let tab of tabs" [root]="tab.page" [tabTitle]="tab.title"></ion-tab>
</ion-tabs>
tabs = [{
page: HomePage,
title: 'Home'
}, {
page: AboutPage,
title: 'About'
}];