Topic: Tab active in mdb-tabset
birmain
pro
asked 7 years ago
Damian Gemza
staff
answered 7 years ago
ngAfterViewInit() {
this.staticTabs.setActiveTab(3);
setTimeout(() => {
this.staticTabs.tabEl.forEach(element=> {
if (element.nativeElement.classList.contains('active')) {
console.log(element);
}
});
}, 500);
}
birmain pro commented 7 years ago
Thanks for your reply: I am thinking of a solution and I have devised the following: In HTML: <mdb-tabset #staticTabs (hiddenBsTab) = "onChangeTab ()"> In Component: private tabActive (): number { let i: number; for (i = 0; i <this.staticTabs.tabs.length; i ++) { if (! this.staticTabs.tabs [i] ['active']) {break; } } return i + 1; } tabCurrentActive: number; onChangeTab () { this.tabCurrentActive = this.tabActive (); }Damian Gemza staff commented 7 years ago
Does this solution works to you?birmain pro commented 7 years ago
The above is only valid for two tabs. No available events provide a status in which the active tab can be viewed. I will continue studying.Damian Gemza staff commented 7 years ago
Thanks for your report, we'll try to fix this problem with future releases. Best Regards, DamianFREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
birmain pro commented 7 years ago
The above is only valid for two tabs. No available events provide a status in which the active tab can be viewed. I will continue studying.