Reputation: 1526
I have a chosen Multi Select input using AngularJS 1.x. and i'm having a problem when i add new items to this input.
I followed this instructions of this website: Adding new values to chosen plugin
This works well, putting in case 13 (Enter) when there is no results in search:
case 13:
evt.preventDefault();
if (this.results_showing) {
if (!this.is_multiple || this.result_highlight) {
return this.result_select(evt);
}
$(this.form_field).append('<option>' + $(evt.target).val() + '</option>');
$(this.form_field).trigger('chosen:updated');
this.result_highlight = this.search_results.find('li.active-result').last();
return this.result_select(evt);
}
break;
But it works in JQUERY way, and i'm having problems to put it on the Angular Way. There is anyone who can solve this? Any ideas?
Here is a Plunk to help you guys: PLUNKER
Thanks a LOT!
Upvotes: 0
Views: 303
Reputation: 568
Try this one, works like a charm
Here a sample
<tags-input
replace-spaces-with-dashes='false'
ng-model="vm.categories"
placeholder="Add category">
<auto-complete min-length="1"
source="vm.loadMatchingTags($query)">
</autocomplete>
</tags-input>
Upvotes: 1