我正在使用角度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的快捷方法?
答案 0 :(得分: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)