【问题标题】:AngularJS ui-select: option not added when typed fullyAngularJS ui-select:完全输入时未添加选项
【发布时间】:2015-07-14 23:34:01
【问题描述】:

我正在使用 angular ui-select,我希望允许用户使用自动完成来选择一个选项,但也允许他们输入自定义选项。

我已将控件配置为启用标记但没有标记标签,如下所示:

<ui-select multiple tagging tagging-label="false" ng-model="colors" theme="bootstrap" style="width: 300px;" title="Choose a color">
  <ui-select-match placeholder="Select colors...">{{$item}}</ui-select-match>
  <ui-select-choices repeat="color in availableColors | filter:$select.search">
        {{color}}
  </ui-select-choices>
</ui-select>

这是一个例子 plunkr:http://plnkr.co/edit/YW7WloZCds1XIOS6UsNs?p=preview

问题是,当您输入一个存在于可用颜色中的单词并按 Enter 键时,该选项不会被选中。

在 plunkr 中,如果你输入 Blue 并按回车,你可以看到这个。

我哪里错了?

【问题讨论】:

    标签: angularjs ui-select


    【解决方案1】:

    这似乎是一个与使用tagging-label="false" 相关的已知错误。删除此选项时它可以正常工作,或者您可以找到解决方法。

    https://github.com/angular-ui/ui-select/issues/770

    【讨论】:

    • +1 用于验证我不会发疯。在接受这个答案之前,我会试一试,看看是否有解决方法。
    • 酷,我没有时间尝试任何东西,所以希望有一些简单的东西。祝你好运。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-06
    • 1970-01-01
    • 2015-10-19
    • 2013-06-29
    • 2015-05-13
    • 2021-06-30
    • 2017-08-22
    相关资源
    最近更新 更多