【问题标题】:Does angular-ui/bootstrap typeahead support ng-model-options?angular-ui/bootstrap typeahead 是否支持 ng-model-options?
【发布时间】:2015-06-15 16:27:21
【问题描述】:

我想使用 angular-typeahead 设置 ng-model-options="{ getterSetter: true }。据我了解,在这种情况下 typeahead 应该使用 ng-model 的值作为 getter/setter。

但实际上 typeahead 会覆盖 getter/setter 作为模型的值。看起来 typeahead 不尊重 ng-models-options 的值。

这是我的代码

     <input type="text" class="form-control" 
            id="elem-{$ $id $}" ng-model="value.value"
            ng-model-options="{ getterSetter: true }"
            typeahead="option for option in value.getOptions()">

有什么方法可以让 typeahead 尊重 ng-model-options 并使用 getterSetter。它的功能可用吗?

据我了解,由于某些原因,typeahead 会使用所选值覆盖模型设置器。这里是plankr:http://plnkr.co/edit/a3Ld9eVmysrt8RsyzbhX?p=preview

选择一两个之后,你会看到`value'已经改变了:in不再是一个函数了。

【问题讨论】:

    标签: javascript angularjs angular-ui-bootstrap


    【解决方案1】:

    目前 angular-ui/bootstrap typeahead 不支持 ng-model-options,但有一个 0.13.1 目标版本的补丁。 https://github.com/angular-ui/bootstrap/pull/3865

    【讨论】:

      猜你喜欢
      • 2017-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-02
      • 2016-09-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多