Skip to content

Commit

Permalink
fixes vitalets#104
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkp committed Nov 21, 2015
1 parent 4b40e5d commit 408ceee
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions checklist-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ angular.module('checklist-model', [])
arr.push(item);
}
return arr;
}
}

// remove
function remove(arr, item, comparator) {
Expand Down Expand Up @@ -67,17 +67,14 @@ angular.module('checklist-model', [])
comparator = function (a, b) {
return a[comparatorExpression] === b[comparatorExpression];
};

} else {
comparator = $parse(attrs.checklistComparator)(scope.$parent);
}
}

// watch UI checked change
scope.$watch(attrs.ngModel, function(newValue, oldValue) {
if (newValue === oldValue) {
return;
}
var current = getter(scope.$parent);
if (angular.isFunction(setter)) {
if (newValue === true) {
Expand All @@ -91,7 +88,7 @@ angular.module('checklist-model', [])
checklistChange(scope);
}
});

// declare one function to be used for both $watch functions
function setChecked(newArr, oldArr) {
scope[attrs.ngModel] = contains(newArr, value, comparator);
Expand Down

0 comments on commit 408ceee

Please sign in to comment.