Angularjs 如何在ng模型中使用具有数组的ng重复跟踪
我有两个不同对象的位置列表,比如Angularjs 如何在ng模型中使用具有数组的ng重复跟踪,angularjs,Angularjs,我有两个不同对象的位置列表,比如 公司地点:myCompany.Locations TrpStop位置:load.customer.Locations 我想使用选项从myCompany中选择一个位置 我正在努力: <div ng-repeat="load in load.loadStops"> <select ng-model="load.customer.locations" ng-repeat="location as location.street1 for lo
myCompany.Locations
load.customer.Locations
选项从myCompany中选择一个位置
我正在努力:
<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>
 
位置选择中的跟踪方式
似乎不起作用,因为在选择选项中未预选位置
请指导我如何预选位置
谢谢。使用ng选项而不是ng重复
<select ng-model="load.customer.locations" ng-options="location as location.street1 for location in myCompany.locations track by id">
</select>
制作一个打捞器提供打捞器link@SravyaNagumalli@BadshahTracker请同时提供数据。@SravyaNagumalli我正在使用ng选项,但未按预期工作。如果load.customer.locations中存在一个选项,我想预先选择该选项。请告诉我如何在每次迭代中将ng模型
load.customer.locations
作为唯一的ng模型。我们可以像加载.customer.locations.$index或加载[$index].customer.locations这样吗?因此,我们可以使ng模型独一无二。它将解决这个问题它应该是[(ngModel)]=“load[$index].customer.location你的意思是,我们应该用这个替换ng model=“load.customer.locations”