【问题标题】:ngTagsInput: How to show all results in autocompete?TagsInput:如何在自动完成中显示所有结果?
【发布时间】:2016-05-17 16:27:28
【问题描述】:

我正在使用ngTagsInput,这是我的标记:

<tags-input add-from-autocomplete-only="true" 
            input-tabindex="4" 
            min-length="0" 
            ng-model="news.tags" 
            display-property="tagName" 
            replace-spaces-with-dashes="false" placeholder="Add tag">
  <auto-complete load-on-focus="true" 
                 load-on-empty="true" 
                 min-length="0" 
                 source="loadData('Tag', $query)">
  </auto-complete>
</tags-input>

我只能看到 10 个结果,但我需要查看所有结果。

【问题讨论】:

    标签: javascript angularjs autocomplete ng-tags-input


    【解决方案1】:

    正如on the docs 所说,您可以使用maxResultsToShow 选项设置一次显示多少匹配项:

    <auto-complete load-on-focus="true" 
                   load-on-empty="true" 
                   min-length="0" 
                   source="loadData('Tag', $query)"
                   max-results-to-show="20">
    </auto-complete>
    

    Working Plunker

    FWIW,您的标记告诉我您正在使用 ngTagsInput 的 fork/自定义版本,因为该指令不知道 input-tabindex 属性。不过,我的回答应该仍然适用。

    【讨论】:

    • 感谢您的示例 - 选择标签后如何使输入散焦?就像现在一样,它只是再次加载标签列表。
    • @KvnH 你能在选择标签后散焦输入吗?正如我想做的一样。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-26
    • 1970-01-01
    • 2013-10-09
    • 2012-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多