Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(tabs): re-added md-on-select and md-on-deselect events to `md…
Browse files Browse the repository at this point in the history
…-tab` directive
  • Loading branch information
Robert Messerle committed Apr 3, 2015
1 parent d47b03a commit c84899d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/tabs/js/tabDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
scope: {
label: '@',
active: '=?mdActive',
disabled: '=?ngDisabled'
disabled: '=?ngDisabled',
select: '&?mdOnSelect',
deselect: '&?mdOnDeselect'
},
link: link
};
Expand All @@ -70,11 +72,11 @@
var tabs = element.parent()[0].getElementsByTagName('md-tab'),
index = Array.prototype.indexOf.call(tabs, element[0]),
data = ctrl.insertTab({
scope: scope,
parent: scope.$parent,
index: index,
scope: scope,
parent: scope.$parent,
index: index,
template: getTemplate(),
label: getLabel()
label: getLabel()
}, index);

scope.$watch('active', function (active) { if (active) ctrl.select(data.getIndex()); });
Expand Down
2 changes: 2 additions & 0 deletions src/components/tabs/js/tabsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@
updateInkBarStyles();
updateHeightFromContent();
$scope.$broadcast('$mdTabsChanged');
ctrl.tabs[oldValue] && ctrl.tabs[oldValue].scope.deselect();
ctrl.tabs[newValue].scope.select();
}

function handleResizeWhenVisible () {
Expand Down

0 comments on commit c84899d

Please sign in to comment.