I have 2 tabs. The last one is disabled on init. After clicking a custom button situated in the first tab, the last tab should enable and select it.
But right now it enable the tab but it doesn't select.
I tried just changing the style as it appears to be disabled but using [ngStyle]
or [class] on ngb-tab
doesn't seems to work. I also tried to navigate (using select) via ngDoCheck
.
Template:
<ngb-tabset #tabSet="ngbTabset" [justify]="'justified'" (tabChange)="tabChange($event)">
<ngb-tab id="tab-1" title="Step 1">
<ng-template ngbTabContent>
First
</ng-template>
</ngb-tab>
<ngb-tab id="tab-2" title="Step 2" [disabled]="disableEnd">
<ng-template ngbTabContent>
Conclusion
</ng-template>
</ngb-tab>
</ngb-tabset>
<button (click)="goToEnd()" *ngIf="actualPage === 1">Send</button>
.ts:
@ViewChild('tabSet', {static: false}) tabSet;
pages: string[] = ["tab-1", "tab-2"];
disableEnd:boolean = true;
goToEnd () : void {
this.disableEnd = false;
this.tabSet.select(this.pages[1]);
}
I want the tab to activate and be selected, ready for viewing.