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

Commit

Permalink
fix(tabs): fixes md-stretch-tabs with one-way binding
Browse files Browse the repository at this point in the history
Closes #3547
  • Loading branch information
Robert Messerle committed Jul 6, 2015
1 parent 4867e31 commit cd3e8a1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/tabs/js/tabsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
destroyed = false,
loaded = false;

//-- define one-way bindings
defineOneWayBinding('stretchTabs');

//-- define public properties with change handlers
defineProperty('focusIndex', handleFocusIndexChange, ctrl.selectedIndex || 0);
defineProperty('offsetLeft', handleOffsetChange, 0);
Expand All @@ -24,7 +27,6 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
defineBooleanAttribute('noInkBar');
defineBooleanAttribute('dynamicHeight', handleDynamicHeight);
defineBooleanAttribute('noPagination');
defineBooleanAttribute('stretchTabs');
defineBooleanAttribute('swipeContent');
defineBooleanAttribute('noDisconnect');
defineBooleanAttribute('autoselect');
Expand Down Expand Up @@ -104,6 +106,11 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
$scope.$watch('$mdTabsCtrl.selectedIndex', handleSelectedIndexChange);
}

function defineOneWayBinding (key) {
var attr = $attrs.$normalize('md-' + key);
$attrs.$observe(attr, function (newValue) { ctrl[key] = newValue; });
}

/**
* Defines boolean attributes with default value set to true. (ie. md-stretch-tabs with no value
* will be treated as being truthy)
Expand Down

0 comments on commit cd3e8a1

Please sign in to comment.