Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leftover text is left in the input field when addFromAutocompleteOnly is set

I am using the ng-tags tags-input like this:

<tags-input ng-model="Tags" placeholder="Add" add-from-autocomplete-only="true">
    <auto-complete source="loadTags($query)"></auto-complete>
</tags-input>

I want any leftover text to disappear when the tags-input field loses control. I wanted to use the allowLeftoverText attribute to achieve this but the documentation says its ignored when the addFromAutocompleteOnly is used.

like image 454
danskov Avatar asked Mar 17 '23 11:03

danskov


1 Answers

Any text left in the input element will remain there until the user removes it herself. The allowLeftoverText function is to mark the element as invalid when there is some leftover text so you can show some error message to the user.

And that option isn't ignored when addFromAutocompleteOnly is true. The documentation was outdated, but it has been fixed already.

Version 3.0 introduced a way to change the input value programmatically. This is how leftover text can be accessed (Note- ng-blur would remove the leftover text):

<tags-input ng-model="tags" text="textVar" ng-blur="textVar=''"></tags-input>
like image 51
Michael Benford Avatar answered Apr 09 '23 15:04

Michael Benford