Topic: MdbTabsComponent setActiveTab not working

tech pro asked 1 year ago


I am using angular mdbtabs with latest version 5.

I am generating the tabs using nfFor as the tabs are dynamic. The active tab is not set ever after i am setting on the ts file

ngOnInit(): void {

this.tabs.tabs.first.active = true
this.tabs.setActiveTab(1)

} ngAfterViewInit(): void { this.tabs.tabs.first.active = true this.tabs.setActiveTab(1) }



Please try to use this code as a workaround for now, we will take a closer look at that to check if we can change something in the component code to fix that:

  ngAfterViewInit() {
    Promise.resolve().then(() => {
      this.tabs.setActiveTab(1);
    });
  }


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: MDB5 2.0.0
  • Device: PC
  • Browser: chrome
  • OS: Windowns
  • Provided sample code: No
  • Provided link: No