Selected index not reset with min-length="1" load-on-empty="true" load-on-focus="true" select-first-match="false"
potatopeelings opened this issue · comments
The previous selected index is retained with min-length="1" load-on-empty="true" load-on-focus="true" select-first-match="false"
Code
<tags-input ng-model="tags" add-on-paste="true">
<auto-complete source="loadTags($query)" min-length="1" load-on-empty="true" load-on-focus="true" select-first-match="false"></auto-complete>
</tags-input>
https://plnkr.co/edit/lipGx6AXp554ScnlQ5Mh?p=preview
Steps
- Focus on the text field and type in t
- Press the down arrow to select Tag4
- Press backspace to (seemingly) reset the match list and selection
- Type in t again
- Press the down arrow
Expected: Tag4 is selected
Actual: Tag5 is selected. The next iteration would select Tag6 and so on
Version of ngTagsInput you are using: v3.2.0
Version of Angular you are using: 1.4.2
Browser (name and version) on which the bug occurs: Chrome 62
I think it has to do with the index not getting reset in tagsInput.directive('autoComplete'
self.show = function() {
if (options.selectFirstMatch) {
self.select(0);
}
else {
self.selected = null;
// needs "self.index = -1;"?
}
self.visible = true;
};
But I'm not familiar enough with the code to raise a PR.
By the way, the Plnkr link in the Github bug template seems to be broken and the Plnkr links from the ng-tags demos page need https for the src files to work when opened in Plnkr. Cheers!
Thanks for open sourcing this directive - its awesome!