Skip to content

tabItems are showed in the wrong order when using *ngIf (angular) #4393

Closed

Description

@aihilali

Please, provide the details below:

Did you verify this is a real problem by searching [Stack Overflow]

yes

Tell us about the problem

tabItems are showed in the wrong order when using *ngIf .

Which platform(s) does your issue occur on?

android, (have not tested on ios yet).

Please provide the following version numbers that your issue occurs with:

nativescript │ 3.0.1 │ 3.0.3 │ Update available │
│ tns-core-modules │ 3.0.1 │ 3.0.1 │ Up to date │
│ tns-android │ 3.0.1 │ 3.0.1 │ Up to date │
│ tns-ios │ │ 3.0.1 │ Not installed

Please tell us how to recreate the issue in as much detail as possible.

-create an app with tabs
-add an *ngif to a tab to be hidden and shown conditionaly.

Activity

  1. NickIliev commented on Jun 15, 2017

    @NickIliev
    Contributor

    @Abderrahmane-H by design in Angular you can not have multiple directives athat are going to create template for your component (in the current context - the tabItem)

    So if you have

    <StackLayout *tabItem="{ title: 'Third' }" *ngIf="isLogged">
    

    You will receive an error of this sort:

    Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with *
    

    Please send us code snippet or sample project demonstrating exactly how you are reproducing the issue.

  2. aihilali commented on Jun 15, 2017

    @aihilali
    Author

    yes I am aware of that, I am using ng-template. here is a code sample

    <!--tab1-->
    <StackLayout *tabItem="{title: 'tab1'">
       <!--content-->
     </StackLayout>
    <!--tab2-->
    <StackLayout *tabItem="{title: 'tab2', iconSource: 'res://ic_action_home'}">
       <!--content 2-->
     </StackLayout>
    <!--tab3-->
    <ng-template [ngIf]="isLoggedIn">
    <StackLayout *tabItem="{title: 'tab3'}">
       <!--content-->
     </StackLayout>
    </ng-template>
    <!--tab4-->
    <StackLayout *tabItem="{title: 'tab4'}">
       <!--content 2-->
     </StackLayout>
    
  3. NickIliev commented on Jun 16, 2017

    @NickIliev
    Contributor
  4. lock commented on Aug 28, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  5. locked and limited conversation to collaborators on Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions