/ TabView内の/動的タブネイティブスクリプト - 角度付き、ネイティブスクリプト

TabViewのダイナミックタブnativescript - 角度、nativescript

ネイティブスクリプトのタブビューに対して動的にタブを作成することは可能ですか?

次の例はnativescriptのドキュメントにあります。

<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>

StackLayout要素には既に*で始まるディレクティブがあるため、ng forを使用することはできません。

回答:

回答№1の場合は3

はい、できます!つかいます *ngFor

<TabView>
<ng-container *ngFor="let tab of tabList">
<StackLayout *tabItem="tab">
.....
</StackLayout>
</ng-container>
</TabView>