Skip to content

Commit

Permalink
Improve model value type
Browse files Browse the repository at this point in the history
  • Loading branch information
indrimuska committed Aug 18, 2016
1 parent 0cf57df commit c11206c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions dist/angular-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@
};

// Default attributes
if (!angular.isDefined(scope.value) && scope.multiple)
scope.value = [];
if (!angular.isDefined(scope.value) && scope.multiple) scope.value = [];
angular.forEach(defaults, function (value, key) {
if (!angular.isDefined(scope[key])) scope[key] = value;
});
Expand Down Expand Up @@ -140,7 +139,7 @@
else scope.value = scope.valueAttr == null ? (value || []) : (value || []).map(function (option) { return scope.getObjValue(option, scope.valueAttr); });
};
scope.hasValue = function () {
return scope.multiple ? (scope.value || []).length > 0 : (scope.valueAttr == null ? (scope.value && !angular.equals({}, scope.value)) : !!scope.value);
return scope.multiple ? (scope.value || []).length > 0 : !!scope.value;
};

// Remote fetching
Expand Down
Loading

0 comments on commit c11206c

Please sign in to comment.