【问题标题】:how to show 2 properties in typeahead angular?如何以预先输入的角度显示 2 个属性?
【发布时间】:2015-08-31 23:32:17
【问题描述】:

我正在使用 angular bootstrap typeahead:

<input type="text" ng-model="selected" selectState(state.id) typeahead-on-select='onSelect($item, $model, $label)'  typeahead="state.name for state in states | filter:$viewValue | limitTo:8" class="form-control">

目前我正在显示 state.name 属性。有没有在输入中同时显示 state.id 和 state.name 的快捷方式?

plunkr: http://plnkr.co/edit/PVXPUiUmLyi80XkY5F9V?p=preview

【问题讨论】:

    标签: angularjs angular-ui-typeahead


    【解决方案1】:

    是的,有:

    <input type="text" ng-model="selected" selectState(state.id) typeahead-on-select='onSelect($item, $model, $label)'  typeahead="(state.id + ' ' + state.name) for state in states | filter:$viewValue | limitTo:8" class="form-control">
    

    state.name 更改为(state.id + ' ' + state.name)

    【讨论】:

      猜你喜欢
      • 2018-08-13
      • 2016-01-14
      • 2017-01-19
      • 2016-11-04
      • 2017-09-22
      • 1970-01-01
      • 2019-08-08
      • 2019-01-13
      • 2014-01-11
      相关资源
      最近更新 更多