0
在nativescript角度應用程序中隱藏tabViewItems的推薦方法是什麼?如何在nativescript(angular)conditionaly中隱藏tabitems?
我試過將ngIf指令合併爲ng-template,但似乎沒有完全支持它。
這裏是我使用的NG-模板,ngIf在使用
<TabView [selectedIndex]="auth.user ? 2 : 4" class="tab-view" sdkExampleTitle sdkToggleNavButton>
<!--shown when logged in-->
<ng-template [ngIf]="auth.user">
<!--notifications tabs-->
<StackLayout *tabItem="{title: 'notifications', iconSource: 'res://ic_action_home'}">
<Label text="NativeScript" class="m-15 h2 text-left" color="blue"></Label>
<ScrollView>
<Label text="content" textWrap="true" class="m-15"></Label>
</ScrollView>
</StackLayout>
<!--messages tabs-->
<StackLayout *tabItem="{title: 'Messages', iconSource: 'res://ic_action_home'}">
<Label text="NativeScript" class="m-15 h2 text-left" color="blue"></Label>
<ScrollView>
<Label text="content" textWrap="true" class="m-15"></Label>
</ScrollView>
</StackLayout>
</ng-template>
<StackLayout *tabItem="{title: 'People', iconSource: 'res://ic_action_home'}">
<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: 'Home', iconSource: 'res://ic_action_home'}">
<RadListView [items]="announcementService.announcements" loadOnDemandMode="Auto" class="list-group">
<ListViewLinearLayout tkListViewLayout scrollDirection="Vertical" itemInsertAnimation="Slide" itemDeleteAnimation="Default">
<ng-template tkListItemTemplate let-item="item">
<GridLayout class="list-group-item" rows="*" columns="auto, *">
<Image row="0" col="0" decodeWidth="60" decodeHeight="60" loadMode="async" src="res://icon" class="thumb img-rounded"></Image>
<StackLayout row="0" col="1">
<Label [text]="item.title" textWrap="true" class="list-group-item-heading"></Label>
<Label class="list-group-item-text" [text]="item.createdAt | amTimeAgo"></Label>
</StackLayout>
</GridLayout>
</ng-template>
</ListViewLinearLayout>
</RadListView>
</StackLayout>
</TabView>
的代碼,它的工作原理是第一次,但重裝後應用它不工作了。
我試過[visibility] =「..condition ..?'visible':'collapse'」,但它不起作用。
我做錯了什麼?