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

Commit

Permalink
feat(tabs): adds an opt-out option for disconnecting tab scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Messerle committed Jun 4, 2015
1 parent a65f563 commit 4c1bf4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/tabs/js/tabsDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
* @param {boolean=} md-center-tabs When enabled, tabs will be centered provided there is no need for pagination
* @param {boolean=} md-no-pagination When enabled, pagination will remain off
* @param {boolean=} md-swipe-content When enabled, swipe gestures will be enabled for the content area to jump between tabs
* @param {boolean=} md-no-disconnect If your tab content has background tasks (ie. event listeners), you will want to include this to prevent the scope from being disconnected
*
* @usage
* <hljs lang="html">
Expand Down Expand Up @@ -94,7 +95,8 @@ function MdTabs ($mdTheming, $mdUtil, $compile) {
centerTabs: '=?mdCenterTabs',
selectedIndex: '=?mdSelected',
stretchTabs: '@?mdStretchTabs',
swipeContent: '=?mdSwipeContent'
swipeContent: '=?mdSwipeContent',
noDisconnect: '=?mdNoDisconnect'
},
template: function (element, attr) {
attr["$mdTabsTemplate"] = element.html();
Expand Down
2 changes: 2 additions & 0 deletions src/components/tabs/js/templateDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ function MdTemplate ($compile, $mdUtil, $timeout) {
scope.$on('$destroy', reconnect);
}
function disconnect () {
if (ctrl.scope.noDisconnect) return;
$mdUtil.disconnectScope(compileScope);
}
function reconnect () {
if (ctrl.scope.noDisconnect) return;
$mdUtil.reconnectScope(compileScope);
}
}
Expand Down

0 comments on commit 4c1bf4b

Please sign in to comment.