Skip to content

Commit

Permalink
fix(tabs): removes scope disconnect logic from tab templates
Browse files Browse the repository at this point in the history
This is necessary due to various bugs with disconnecting scope.  The API
remains the same for now, but in 0.11 we will revise the API's to more
accurately describe what is going on under the hood.

Closes angular#3692
  • Loading branch information
Robert Messerle authored and kennethcachia committed Sep 23, 2015
1 parent b836282 commit ecc06bc
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/components/tabs/js/templateDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ angular
.module('material.components.tabs')
.directive('mdTemplate', MdTemplate);

function MdTemplate ($compile, $mdUtil) {
function MdTemplate ($compile) {
return {
restrict: 'A',
link: link,
scope: {
template: '=mdTemplate',
compileScope: '=mdScope',
connected: '=?mdConnectedIf'
compileScope: '=mdScope'
},
require: '^?mdTabs'
};
Expand All @@ -22,20 +21,5 @@ function MdTemplate ($compile, $mdUtil) {
ctrl.updatePagination();
ctrl.updateInkBarStyles();
});
return $mdUtil.nextTick(handleScope);
function handleScope () {
scope.$watch('connected', function (value) { value === false ? disconnect() : reconnect(); });
scope.$on('$destroy', reconnect);
}

function disconnect () {
if (ctrl.scope.noDisconnect) return;
$mdUtil.disconnectScope(compileScope);
}

function reconnect () {
if (ctrl.scope.noDisconnect) return;
$mdUtil.reconnectScope(compileScope);
}
}
}

0 comments on commit ecc06bc

Please sign in to comment.