Get active tab instance from tab container

How can I get the running instance from the container tab?
Get selected returns the selected Tab instance, but I want my actual implementation of the class (Say for example HomeTab).

And what is the point of having the instance itself?
What do you want to do with it?

1 Like

I want to call a method of that instance when the tab is selected. I already know about willEnter and didEnter, but I’ve a particular case with a Tab inside another Tab. At this level, the events are not triggered. So I need to manually call willEnter and didEnter.

I haven’t used tabs within tabs, but I can indeed see that the event doesn’t bubble up to the 2nd tab.

The easier solution I can think of is the use of events.

Tabs A with pages (1-2-3)
Tabs B with pages (4-5-6), child of page 1
When page 4 is opened, subscribe to an event.
When page 1 is selected, emit that event (maybe with data)
The subscription is triggered in page 4 and some code is executed

1 Like

@federicoponzi: can you mark this thread as solved?
It’s easier for future developers to find the solution when they have the same issue.

While you’re solution is viable I think it’s a bit too hackish, and was waiting for other alternatives. Also marking this thread as solved, dosen’t really help over developers IMO because the proposed solution isn’t strictly related to the thread title.
I might also rename the thread before closing it :slight_smile:
Thank you very much again