Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

feat(tabs): pass the selected tab index to onDeselect #5821

Conversation

ksieburg
Copy link
Contributor

@ksieburg ksieburg commented Apr 19, 2016

@icfantv
Copy link
Contributor

icfantv commented Apr 19, 2016

@ksieburg, I'm ok with this, but it will need a documentation update at well. Thanks.

@ksieburg
Copy link
Contributor Author

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.
Copy link
Contributor

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.

@icfantv
Copy link
Contributor

icfantv commented Apr 19, 2016

@ksieburg one more doc tweak and then please squash your commits.

@ksieburg ksieburg force-pushed the feat-tabs/addSelectedIndexToDeselect branch from 1fca691 to ef58dd3 Compare April 19, 2016 16:51
@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

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
@ksieburg ksieburg force-pushed the feat-tabs/addSelectedIndexToDeselect branch from ef58dd3 to 8a3a833 Compare April 19, 2016 18:44
@icfantv
Copy link
Contributor

icfantv commented Apr 19, 2016

LGTM

@wesleycho wesleycho closed this in 241fea8 Apr 19, 2016
@wesleycho wesleycho added this to the 1.3.3 milestone Apr 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants