Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(slider): watch ngDisabled expr on non-isolate parent scope
Browse files Browse the repository at this point in the history
Closes #272.
  • Loading branch information
ajoslin committed Sep 17, 2014
1 parent 2851ab4 commit 5f1923d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/slider/demo1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h3>
<div flex="10" layout layout-align="center center">
<span>R</span>
</div>
<material-slider ng-disabled="color.green < 125" flex min="0" max="255" ng-model="color.red" aria-label="red" id="red-slider">
<material-slider flex min="0" max="255" ng-model="color.red" aria-label="red" id="red-slider">
</material-slider>
<div flex="20" layout layout-align="center center">
<input type="number" ng-model="color.red" aria-label="red" aria-controls="red-slider">
Expand Down
3 changes: 2 additions & 1 deletion src/components/slider/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function SliderController(scope, element, attr, $$rAF, $timeout, $window, $mater
attr.step ? attr.$observe('step', updateStep) : updateStep(1);

attr.ngDisabled ?
scope.$watch(attr.ngDisabled, updateAriaDisabled) :
scope.$parent.$watch(attr.ngDisabled, updateAriaDisabled) :
updateAriaDisabled(!!attr.disabled);

$aria.expect(element, 'aria-label');
Expand Down Expand Up @@ -168,6 +168,7 @@ function SliderController(scope, element, attr, $$rAF, $timeout, $window, $mater
redrawTicks();
}
function updateAriaDisabled(isDisabled) {
console.log('updateAriaDislabed', isDisabled);
element.attr('aria-disabled', !!isDisabled);
}

Expand Down

0 comments on commit 5f1923d

Please sign in to comment.