2016-11-17 116 views
0

即时通讯尝试从.ts文件中的数组制作动态选项卡。动态离子2选项卡

我得到这个模板的多片组件:

<ion-content class="myclass"> 
    <ion-tabs tabsPlacement="top"> 
    <ion-tab *ngFor="let tab of tabs" tabTitle="tab.title" [root]="tab.component"></ion-tab> 
    </ion-tabs> 
</ion-content> 

这是我multitab.ts组件:

@Component({ 
    selector: 'multi-tab', 
    templateUrl: 'multitab.html' 
}) 
export class multiTab { 

    tabs : any = []; 

    constructor() { 
     this.tabs.push({title: 'Snacks', component: Snacks}); 
     this.tabs.push({title: 'Drinks', component: Drinks}); 
     this.tabs.push({title: 'Frozen', component: Frozen}); 
    } 
} 

但我的自定义组件的只显示第一个与所有喜欢的功能它是一个单独的选项卡/列表而不是离子选项卡。

我使用2.0.0 rc-2版本的离子。

回答

-1

我找到了答案,我的标签栏只在标题下,这就是为什么它看起来好像没有出现。我发布这个,如果有人也有这个问题。

+0

如何在页面中调用此“多选项卡”选项卡? – Moumita