Topic: MDB Angular Pro Tabs - Set Default Active Tab
nick.celestin pro asked 7 years ago
Dawid Adach pro answered 7 years ago
Dear nick.celestin,
You can programmatically select any tab as follow:
app.component.ts
import { Component, OnInit, ViewChild } from '@angular/core'; import { TabsetComponent } from 'ng-mdb-pro/pro/tabs-pills/tabset.component'; @ViewChild('staticTabs') staticTabs: TabsetComponent;
ngOnInit() { this.staticTabs.tabs[2].active=true; }
Andrea Punta answered 9 months ago
I think in the newer version you have to use the:
import { AfterViewInit } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { MdbTabsComponent } from 'mdb-angular-ui-kit/tabs';
@ViewChild('tabs') tabs: MdbTabsComponent;
ngAfterViewInit() {
this.tabs.setActiveTab(1);
}
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No