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

Commit

Permalink
feat(tabs): makes swipe gestures on the content area opt-in
Browse files Browse the repository at this point in the history
Closes #2331

BREAKING CHANGE: Tabs will now require the `md-swipe-content` attribute in order to enable swipe gestures to change tabs in the content area.
  • Loading branch information
Robert Messerle committed Jun 4, 2015
1 parent 0c073d1 commit 03d01e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/tabs/js/tabsDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* @param {boolean=} md-dynamic-height When enabled, the tab wrapper will resize based on the contents of the selected tab
* @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
*
* @usage
* <hljs lang="html">
Expand Down Expand Up @@ -92,7 +93,8 @@ function MdTabs ($mdTheming, $mdUtil, $compile) {
dynamicHeight: '=?mdDynamicHeight',
centerTabs: '=?mdCenterTabs',
selectedIndex: '=?mdSelected',
stretchTabs: '@?mdStretchTabs'
stretchTabs: '@?mdStretchTabs',
swipeContent: '=?mdSwipeContent'
},
template: function (element, attr) {
attr["$mdTabsTemplate"] = element.html();
Expand Down Expand Up @@ -175,8 +177,8 @@ function MdTabs ($mdTheming, $mdUtil, $compile) {
id="tab-content-{{tab.id}}"\
role="tabpanel"\
aria-labelledby="tab-item-{{tab.id}}"\
md-swipe-left="$mdTabsCtrl.incrementSelectedIndex(1)"\
md-swipe-right="$mdTabsCtrl.incrementSelectedIndex(-1)"\
md-swipe-left="swipeContent && $mdTabsCtrl.incrementSelectedIndex(1)"\
md-swipe-right="swipeContent && $mdTabsCtrl.incrementSelectedIndex(-1)"\
ng-if="$mdTabsCtrl.hasContent"\
ng-repeat="(index, tab) in $mdTabsCtrl.tabs" \
md-template="tab.template"\
Expand Down

0 comments on commit 03d01e9

Please sign in to comment.