2017-05-29 5 views
0

nativescript角度アプリケーションでtabViewItemsを非表示にするには、どのような方法が推奨されますか。nativescript(angular)のtabitemsを非表示にする方法は?

ngIfディレクティブをng-templateと組み合わせてみましたが、完全にサポートされていないようです。ここ

は私が

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

ngIfとngのテンプレートを使用しているとき、それは最初の時間のために働くが、アプリケーションを再ロードした後、それはもう動作しませんを使用していたコードです。

私は[visibility] = "..condition ..?" visible ':' collapse '"を試しましたが、動作しませんでした。

私は何か間違っていますか?

答えて

0

このような何かは仕事ができる:

<ng-container *ngIf="isLoggedIn()"> 
    <StackLayout> 
    // ... 
    </StackLayout> 
</ng-container> 
関連する問題