Angular TabView nativescript中的动态选项卡
是否可以在nativescript中为选项卡视图动态创建选项卡 以下示例在nativescript的文档中Angular TabView nativescript中的动态选项卡,angular,nativescript,Angular,Nativescript,是否可以在nativescript中为选项卡视图动态创建选项卡 以下示例在nativescript的文档中 <TabView selectedIndex="0" (selectedIndexChange)="onIndexChanged($event)" sdkExampleTitle sdkToggleNavButton> <StackLayout *tabItem="{title: 'NativeScript'}"> <Label te
<TabView selectedIndex="0" (selectedIndexChange)="onIndexChanged($event)" sdkExampleTitle sdkToggleNavButton>
<StackLayout *tabItem="{title: 'NativeScript'}">
<Label text="NativeScript" class="m-15 h2 text-left" color="blue"></Label>
<ScrollView>
<Label [text]="content" textWrap="true" class="m-15"></Label>
</ScrollView>
</StackLayout>
<StackLayout *tabItem="{title: 'Icon'}">
<Image class="m-t-30 m-b-15" src="res://icon" width="80" height="80"></Image>
<Label text="NativeScript" textWrap="true" class="h2 m-x-auto" color="blue"></Label>
</StackLayout>
</TabView>
而且它不允许我使用ng for,因为StackLayout元素已经有了一个以*开头的指令,可以!使用
*ngFor
<TabView>
<ng-container *ngFor="let tab of tabList">
<StackLayout *tabItem="tab">
.....
</StackLayout>
</ng-container>
</TabView>
.....
谢谢,我按照你说的做了尝试,但是没有生成选项卡1和选项卡2的视图,但是如果我在其他选项卡之间浏览并返回到已经出现的第一个选项卡,有什么建议吗?我遇到了同样的问题!y我没有一个正确的答案,但对我有效的是我的数据是从服务(=>订阅)中提取出来的,但当我转向数据库时,承诺它有效,让我痛苦的是,我没有找到任何关于“TabView items dynamic content”的信息。我在谷歌上搜索了两天,当我遇到你的问题时,它仍然在我身上发生。你们中的一些人找到并回答了。。。?