Skip to content

Commit

Permalink
Merge pull request #61 from liorch88/no-model-modifications
Browse files Browse the repository at this point in the history
Avoid modifying the model value type
  • Loading branch information
indrimuska authored Aug 18, 2016
2 parents 50ad38d + 3b72ab0 commit 0cf57df
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-selector",
"version": "1.4.1",
"version": "1.4.2",
"authors": [
"Indri Muska <indrimuska@gmail.com>"
],
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-selector.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! angular-selector - v1.4.1 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
/*! angular-selector - v1.4.2 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
@-webkit-keyframes selector-rotate { 0% { -webkit-transform: rotateZ(-359deg); } 100% { -webkit-transform: rotateZ(0deg); } }
@-moz-keyframes selector-rotate { 0% { -moz-transform: rotateZ(-359deg); } 100% { -moz-transform: rotateZ(0deg); } }
@-o-keyframes selector-rotate { 0% { -o-transform: rotateZ(-359deg); } 100% { -o-transform: rotateZ(0deg); } }
Expand Down
10 changes: 5 additions & 5 deletions dist/angular-selector.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! angular-selector - v1.4.1 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
/*! angular-selector - v1.4.2 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
(function (angular) {

// Key codes
Expand Down Expand Up @@ -86,8 +86,8 @@
};

// Default attributes
if (!angular.isDefined(scope.value))
scope.value = scope.multiple ? [] : '';
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 @@ -136,11 +136,11 @@

// Value utilities
scope.setValue = function (value) {
if (!scope.multiple) scope.value = scope.valueAttr == null ? (value || {}) : scope.getObjValue(value || {}, scope.valueAttr);
if (!scope.multiple) scope.value = scope.valueAttr == null ? value : scope.getObjValue(value || {}, scope.valueAttr);
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 ? !angular.equals({}, scope.value) : !!scope.value);
return scope.multiple ? (scope.value || []).length > 0 : (scope.valueAttr == null ? (scope.value && !angular.equals({}, scope.value)) : !!scope.value);
};

// Remote fetching
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-selector.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0cf57df

Please sign in to comment.