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

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 #3692
  • Loading branch information
Robert Messerle committed Jul 31, 2015
1 parent af05235 commit 2976add
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 2976add

Please sign in to comment.