Was ist die empfohlene Methode zum Ausblenden von tabViewItems in einer nativescript-eckigen Anwendung.wie tabitems in nativescript (angular) bedingt ausblenden?
Ich habe versucht, die ngIf-Anweisung mit der ng-Vorlage kombiniert, aber es schien, dass es nicht vollständig unterstützt wird.
hier ist der Code, den ich
<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>
bin mit, wenn die ng-Vorlage mit ngIf verwenden, ist es zum ersten Mal funktioniert, aber nach der Anwendung Neuladen es nicht mehr funktioniert.
Ich habe versucht [Sichtbarkeit] = "..condition ..? 'Sichtbar': 'Zusammenbruch'", und es hat nicht funktioniert.
Ich mache etwas falsch?