【问题标题】:NgTagsInput add on enter adds from autocomplete and not what is typedNgTagsInput add on enter 从自动完成添加而不是输入的内容
【发布时间】:2017-09-11 13:39:55
【问题描述】:

我有一个这样的标签输入字段:

    <tags-input class="bootstrap"
            ng-model="tags"
            placeholder="Voeg een tag toe"
            replace-spaces-with-dashes="false"
            add-from-autocomplete-only="false">
    <auto-complete source="loadTags($query)"
                 min-length="0"
                 debounce-delay="0"
                 load-on-focus="true"
                 load-on-empty="true"
                 selectFirstMatch="false"
                 max-results="10"></auto-complete>
    </tags-input>

这是加载标签:

$scope.loadTags = function(query) {
    return [
        'Productie',
        'Gevelreclame',
        'Studio',
        'Freesletters',
        'Online',
        'Peter',
        'Gerroy',
        'Robert'
    ];
};

但是当我键入添加标签时,我按回车键添加它会添加从自动完成中选择的标签,而不是我输入的值。但是当我点击输入时,它会添加带有我输入的值的标签。但我希望这也可以与输入一起使用。这个我想不通。

希望你能帮忙!

【问题讨论】:

    标签: angularjs angularjs-directive ng-tags-input


    【解决方案1】:

    在 tagsinput 我需要添加属性:add-from-autocomplete-only="false" 在自动完成上我需要添加属性:select-first-match="false"。

    这为我解决了问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-30
      • 2019-10-30
      • 1970-01-01
      • 2021-06-15
      • 1970-01-01
      • 2014-11-17
      • 1970-01-01
      相关资源
      最近更新 更多