0

As in the title writes, is it possible to intercept tab change event and execute some function before that occurs?

1 Answer 1

0

Yes you can, just add an ng-click on the uib-tab directive

Here's a demo plunker (note how the code runs before the view changes).

Sign up to request clarification or add additional context in comments.

4 Comments

I have thought of that solution but haven't dared to try, thanks! I was thinking whether is there some better way instead of putting ng-click directive on the every tab? I think that this wouldn't be possible to do if I'm adding new tabs later i.e. dynamically?
if you'll add them dynamically, you'll probably use something like ng-repeat, and that will just recopy the same template with the ng-click, if you'll want something more "robust" you can use promises (i.e. cancel event if the promise rejects..)
I have one more question: Why do I have to include $event in the function if it's not used?
you don't really need, i've added it but didn't used it, basically it's the event object, you can modify, and event cancel it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.