-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(tabs): pass the selected tab index to onDeselect #5821
feat(tabs): pass the selected tab index to onDeselect #5821
Conversation
ksieburg
commented
Apr 19, 2016
•
edited
Loading
edited
- Add the index of the tab the user attempted to open to the onDeselect call, which allows the user to be directed to the selected tab after some work is performed.
- Closes Tabs: Add selected tab index to the onDeselect parameters #5820
@ksieburg, I'm ok with this, but it will need a documentation update at well. Thanks. |
All set. Thanks! |
@@ -33,7 +33,7 @@ AngularJS version of the tabs directive. | |||
|
|||
* `deselect()` | |||
<small class="badge">$</small> - | |||
An optional expression called when tab is deactivated. Supports $event in template for expression. You may call `$event.preventDefault()` in this event handler to prevent a tab change from occurring. | |||
An optional expression called when tab is deactivated. Supports $event and selectedTabIndex in template for expression. You may call `$event.preventDefault()` in this event handler to prevent a tab change from occurring. The selectedTabIndex can be used to determine which tab was attempted to be opened. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selectedTabIndex
(backticks) - also could you similarly wrap $event while you're in there? Thanks.
@ksieburg one more doc tweak and then please squash your commits. |
1fca691
to
ef58dd3
Compare
@@ -11,7 +11,8 @@ angular.module('ui.bootstrap.tabs', []) | |||
var previousSelected = ctrl.tabs[previousIndex]; | |||
if (previousSelected) { | |||
previousSelected.tab.onDeselect({ | |||
$event: evt | |||
$event: evt, | |||
selectedTabIndex: index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using the key $selectedIndex
would be better, just to emphasize that it is a special value provided by UI Bootstrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've amended the commit.
- Add the index of the tab the user attempted to open to the onDeselect call, which allows the user to directed to the selected tab after some work is performed. - Closes angular-ui#5820
ef58dd3
to
8a3a833
Compare
LGTM |