4

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.

4

1 に答える 1

7

入力要素に残っているテキストは、ユーザーが自分で削除するまでそこに残ります。このallowLeftoverText機能は、テキストが残っている場合に要素を無効としてマークし、ユーザーにエラーメッセージを表示できるようにすることです。

addFromAutocompleteOnlyが true の場合、そのオプションは無視されません。ドキュメントは古くなっていますが、すでに修正されています。

バージョン 3.0 では、入力値をプログラムで変更する方法が導入されました。これは残りのテキストにアクセスする方法です (Note-ng-blur は残りのテキストを削除します):

<tags-input ng-model="tags" text="textVar" ng-blur="textVar=''"></tags-input>
于 2015-04-10T03:34:30.023 に答える