0

I'm trying to select Tab2 by default, But it's not working correctly, It's selecting both tabs. I can see Hello and World on screen.

<p-tabView>
    <p-tabPanel header="Tab1">
        Hello
    </p-tabPanel>
    <p-tabPanel header="Tab2" [selected]="true">
        World
    </p-tabPanel>
</p-tabView>

I'm using primeng version 4.1.2.

Reference: https://www.primefaces.org/primeng/#/tabview

vivek nuna
  • 16,885
  • 12
  • 74
  • 152

1 Answers1

1

I have solved the issue, posting here so that it can help others.

I was using *ngIf="someCondition" with <p-tabPanel header="Tab1"> tag, I have used [hidden]="!someCondition" eqivalent of ng-hide="someCondition" in AngularJS.

<p-tabView>
    <p-tabPanel header="Tab1">
        Hello
    </p-tabPanel>
    <p-tabPanel header="Tab2" [selected]="true" [hidden]="!someCondition">
        World
    </p-tabPanel>
</p-tabView>

The reason you can find here.

vivek nuna
  • 16,885
  • 12
  • 74
  • 152