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

Commit

Permalink
fix(select): bug using select attr with inferred value
Browse files Browse the repository at this point in the history
  • Loading branch information
rschmukler committed Apr 10, 2015
1 parent ade76f9 commit e20b190
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,18 +591,20 @@ function OptionDirective($mdInkRipple, $mdUtil) {
scope.$watch(function() { return element.text(); }, setOptionValue)
}

attr.$observe('selected', function(selected) {
if (!angular.isDefined(selected)) return;
if (selected) {
if (!selectCtrl.isMultiple) {
selectCtrl.deselect( Object.keys(selectCtrl.selected)[0] );
scope.$$postDigest(function() {
attr.$observe('selected', function(selected) {
if (!angular.isDefined(selected)) return;
if (selected) {
if (!selectCtrl.isMultiple) {
selectCtrl.deselect( Object.keys(selectCtrl.selected)[0] );
}
selectCtrl.select(optionCtrl.hashKey, optionCtrl.value);
} else {
selectCtrl.deselect(optionCtrl.hashKey);
}
selectCtrl.select(optionCtrl.hashKey, optionCtrl.value);
} else {
selectCtrl.deselect(optionCtrl.hashKey);
}
selectCtrl.refreshViewValue();
selectCtrl.ngModel.$render();
selectCtrl.refreshViewValue();
selectCtrl.ngModel.$render();
});
});

$mdInkRipple.attachButtonBehavior(scope, element);
Expand Down

0 comments on commit e20b190

Please sign in to comment.