Angular UI Bootstrap 按对象属性提前输入
Angular UI Bootstrap Typeahead by object properties
我有一个类似的对象(仿地图):
$scope.vehicles = {
1:{id:1, model:'Sedan'},
2:{id:2, model:'SUV'},
3:{id:3, model:'Van'}
}
我需要在 ui bootstrap 的预输入中使用属性值(通过 'model' 属性 保存过滤)
下一个变体不起作用:
<input type="text" ng-model="vehicle"
uib-typeahead="vehicle as vehicle.model for (id, vehicle) in vehicles | filter:{model:$viewValue} | limitTo:10">
使用对象属性列表需要特殊功能
$scope.getVehicleList = function () {
return Object.values($scope.vehicles);
}
提前输入元素:
<input type="text" ng-model="vehicle"
uib-typeahead="vehicle as vehicle.model for vehicle in getVehicleList() | filter:{model:$viewValue} | limitTo:10">
我有一个类似的对象(仿地图):
$scope.vehicles = {
1:{id:1, model:'Sedan'},
2:{id:2, model:'SUV'},
3:{id:3, model:'Van'}
}
我需要在 ui bootstrap 的预输入中使用属性值(通过 'model' 属性 保存过滤)
下一个变体不起作用:
<input type="text" ng-model="vehicle"
uib-typeahead="vehicle as vehicle.model for (id, vehicle) in vehicles | filter:{model:$viewValue} | limitTo:10">
使用对象属性列表需要特殊功能
$scope.getVehicleList = function () {
return Object.values($scope.vehicles);
}
提前输入元素:
<input type="text" ng-model="vehicle"
uib-typeahead="vehicle as vehicle.model for vehicle in getVehicleList() | filter:{model:$viewValue} | limitTo:10">