Skip to content

Commit

Permalink
fix(CheckedObserver): handle falsey model
Browse files Browse the repository at this point in the history
  • Loading branch information
jdanyow committed Jul 10, 2016
1 parent e77e161 commit 9d39a1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/checked-observer.js
Expand Up @@ -65,7 +65,7 @@ export class CheckedObserver {
element.checked =
isRadio && !!matcher(value, elementValue)
|| !isRadio && value === true
|| !isRadio && Array.isArray(value) && !!value.find(item => !!matcher(item, elementValue));
|| !isRadio && Array.isArray(value) && value.findIndex(item => !!matcher(item, elementValue)) !== -1;
}

synchronizeValue() {
Expand Down
2 changes: 1 addition & 1 deletion src/select-value-observer.js
Expand Up @@ -71,7 +71,7 @@ export class SelectValueObserver {
}
let optionValue = option.hasOwnProperty('model') ? option.model : option.value;
if (isArray) {
option.selected = !!value.find(item => !!matcher(optionValue, item)); // eslint-disable-line no-loop-func
option.selected = value.findIndex(item => !!matcher(optionValue, item)) !== -1; // eslint-disable-line no-loop-func
continue;
}
option.selected = !!matcher(optionValue, value);
Expand Down

0 comments on commit 9d39a1a

Please sign in to comment.