【问题标题】:Ng-Tag-input minLength not set propertyNg-Tag-input minLength 未设置属性
【发布时间】:2015-10-09 11:27:29
【问题描述】:

我在我的 ionic 项目(跨平台移动应用程序)中使用这个库,我尝试设置 minLength : 1 但它采用默认值(即 3)。我怎样才能做到这一点?

【问题讨论】:

  • 你能提供你正在使用的标记吗?
  • tagsInputConfigProvider .setDefaults('tagsInput', { placeholder: 'New tag', minLength: 1, addOnEnter: false, keyProperty: 'Name', displayProperty:'Name' }) .setDefaults('autoComplete ', { debounceDelay: 200, loadOnDownArrow: true, loadOnEmpty: true })

标签: ng-tags-input


【解决方案1】:

将min-length="1" 属性设置为<auto-complete> 而不是<tags-input> 以获得每个字符的建议。

像这样:

       <tags-input ng-model="vm.tags">
            <auto-complete source="vm.loadTags($query)"
                           min-length="1" 
                           highlightMatchedText="true">
            </auto-complete>
       </tags-input>

即使我花了几个小时弄清楚如何去做,后来当我再次阅读 autoComplete 的文档时,它让我眼前一亮。

http://mbenford.github.io/ngTagsInput/documentation/api#autoComplete

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-09
    • 1970-01-01
    相关资源
    最近更新 更多