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

Commit cd3e8a1

Browse files
author
Robert Messerle
committed
fix(tabs): fixes md-stretch-tabs with one-way binding
Closes #3547
1 parent 4867e31 commit cd3e8a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/tabs/js/tabsController.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
1515
destroyed = false,
1616
loaded = false;
1717

18+
//-- define one-way bindings
19+
defineOneWayBinding('stretchTabs');
20+
1821
//-- define public properties with change handlers
1922
defineProperty('focusIndex', handleFocusIndexChange, ctrl.selectedIndex || 0);
2023
defineProperty('offsetLeft', handleOffsetChange, 0);
@@ -24,7 +27,6 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
2427
defineBooleanAttribute('noInkBar');
2528
defineBooleanAttribute('dynamicHeight', handleDynamicHeight);
2629
defineBooleanAttribute('noPagination');
27-
defineBooleanAttribute('stretchTabs');
2830
defineBooleanAttribute('swipeContent');
2931
defineBooleanAttribute('noDisconnect');
3032
defineBooleanAttribute('autoselect');
@@ -104,6 +106,11 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
104106
$scope.$watch('$mdTabsCtrl.selectedIndex', handleSelectedIndexChange);
105107
}
106108

109+
function defineOneWayBinding (key) {
110+
var attr = $attrs.$normalize('md-' + key);
111+
$attrs.$observe(attr, function (newValue) { ctrl[key] = newValue; });
112+
}
113+
107114
/**
108115
* Defines boolean attributes with default value set to true. (ie. md-stretch-tabs with no value
109116
* will be treated as being truthy)

0 commit comments

Comments
 (0)