On tab change is private though...
# package-development
l
On tab change is private though...
p
But we were talking about an event handler that triggers on tabs changing right?
l
Yep, thats how I interpret the question of Richard
r
Yup and will check later thanks!
n
Hi, you are on the right path. The tab is 'just' some UI that triggeres a URL change(Or calls some JavaScript depending on the actual implementation we are talking about), But lets focus on the most usual one, when we have URLs for each tab. Cause those can also be navigated to in other ways, like browser navigation or other links. So the origin of the active view/and if something changes, is the Router Slot, for that there is a Route Context that you can consume and it has two Observables that you can use. (
activeLocalPath
and
activePath
) If you dont need the full URL, then just observe the
activeLocalPath
Copy code
this.consumeContext(UMB_ROUTE_CONTEXT, (context) => {
            this.observe(context.activeLocalPath, (activeLocalPath) => {
                console.log('Active tab slug is', activelocalPath)
            });
        });
I hope that helps 🙂
r
Ah was to soon with my other reply did not know about UMB_ROUTE_CONTEXT either click will work for this issue but will look into UMB_ROUTE_CONTEXT as well for other parts in the section I am buidling
n
Cool — We have to improve the context debugging so it becomes easier to discover what is available for a specific case.
r
That would be very nice indeed.
2 Views