Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions dist/angular-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
promise
.then(function (data) {
scope.options = data.data || data;
allOptions = allOptions.concat(scope.options);
scope.filterOptions();
scope.loading = false;
initDeferred.resolve();
Expand Down Expand Up @@ -492,12 +493,15 @@
// Update selected values
scope.updateSelected = function () {
if (!scope.multiple) scope.selectedValues = (scope.options || []).filter(function (option) { return scope.optionEquals(option); }).slice(0, 1);
else
scope.selectedValues = (scope.value || []).map(function (value) {
return filter(scope.options, function (option) {
return scope.optionEquals(option, value);
})[0];
}).filter(function (value) { return angular.isDefined(value); }).slice(0, scope.limit);
else {
var val;
val = (scope.value || []).map(function (value) {
return filter(scope.options.concat(allOptions), function (option) {
return scope.optionEquals(option, value);
})[0];
}).filter(function (value) { return angular.isDefined(value); }).slice(0, scope.limit);
scope.selectedValues = val;
}
};
scope.$watch('value', function (newValue, oldValue) {
if (angular.equals(newValue, oldValue)) return;
Expand Down Expand Up @@ -616,4 +620,4 @@
return new Selector($filter, $timeout, $window, $http, $q);
}]);

})(window.angular);
})(window.angular);
Loading