我有两个来自两个不同对象的位置列表,例如
employee_name.autocomplete({
source: function (request, response) {
ajax.jsonRpc("/employee_search", "call", {"name": employee_name.val()})
.then(function (data) {
response(data);
console.debug(response);
});
}
});
myCompany.locations
我想使用load.customer.locations
选项从myCompany中选择一个位置。
我正在尝试:
<select>
位置选择中的
<div ng-repeat="load in load.loadStops"> <select ng-model="load.customer.locations" ng-repeat="location as location.street1 for location in myCompany.locations track by location.id"> <option value="" > </option> </select> </div>
似乎无法正常工作,因为未在选择选项中预选择位置。
请指导我如何预选位置?
谢谢。
答案 0 :(得分:0)
使用ng-options代替ng-repeat
<select ng-model="load.customer.locations" ng-options="location as location.street1 for location in myCompany.locations track by id">
</select>