I am using the Nebular Theme component and will want to manually activate a particular tab with a button click. I can't find any information in their doc https://akveo.github.io/nebular/docs/components/tabs/overview#nbtabsetcomponent
<nb-tabset>
<nb-tab tabTitle="Search">xxxx</ng-tab>
<nb-tab tabTitle="Add">yyyyy</ng-tab>
</nb-tabset>
<button (click)="ActivateTabAdd()">Add</button>
Any help appreciated. Thanks
Yes why not
there is an active
attribute for tab nb-tab
which Specifies active tab
so you can handle this like
<nb-tabset>
<nb-tab tabTitle="Search" active="{{setActiveSearch}}">xxxx</ng-tab>
<nb-tab tabTitle="Add" active="{{setActiveAdd}}" >yyyyy</ng-tab>
</nb-tabset>
<button (click)="ActivateTabAdd()">Add</button>
and in TS file
setActiveSearch : boolean = false;
setActiveAdd: boolean = false;
ActivateTabAdd(){
this.setActiveAdd = true;
}
<nb-tabset id="tabset" name="tabset" #tabset>
<nb-tab tabTitle="Search" id="searchTab" name="searchTab" #searchTab >xxxx</ng-tab>
<nb-tab tabTitle="Add" id="addTab" name="addTab" #addTab >yyyyy</ng-tab>
</nb-tabset>
<button (click)="ActivateTabAdd()">Add</button>
import { NbTabsetComponent, NbTabComponent } from '@nebular/theme/components/tabset/tabset.component';
@ViewChild("tabset") tabsetEl: NbTabsetComponent;
@ViewChild("addTab") addTabEl: NbTabComponent;
ActivateTabAdd(){
this.tabsetEl.selectTab(this.addTabEl);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With