Typing and selecting an option with remote fetching causes invalid values
Plunker
http://plnkr.co/edit/CGY47bqX0dLnFkrVY3aB?p=preview
Scenario
- Multiple select
- Remote fetching
- No remote validation
Steps to reproduce the issue
- type "f" in the input field
- press Enter
@indrimuska This has another issue as well. Selected options are removed after fetching in a multi selector.
Same scenario. Same plunker.
Steps to reproduce the issue
- Click the selector
- Select 3 options, say, Afghanistan - Aland Islands - Albania
- Type "Bra" to get "Brazil"
- Select "Brazil".
Hi guys , Any update on this issue , kinda critical issue if some one points to me to right direction i might able to solve it !
@matt212 Try my fork.
The problem was here:
scope.updateSelected = function () {
if (!scope.multiple) scope.selectedValues = (scope.options || []).filter(function (option) { return scope.optionEquals(option); }).slice(0, 1);
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;
}
};
Options were being filtered after fetching again. I'm storing the options being fetched in my fork, had no time to implement a better solution att.
Hi @ssotomayor , you are life saver ! thanks for insight and patch !
How can i add values using create feature not from user input but from angularjs file. for eg :- instance of "selector" ,create (json object) and it should added to multiselect Any suggestions ? `
This is fixed in a high performance variant/fork of the same component: https://github.com/jkodu/angular-selector-on-steroids
Refer enhanced example page - https://jkodu.github.io/angular-selector-on-steroids/ (allow unsafe scripts).
@jkodu oh wow, did you fix the remote fetching issue mentioned above? Can't get the options to load up on your example page.
Have you allowed unsafe scripts along the prompt on the address bar?
@ssotomayor see comment above.