【发布时间】:2015-09-24 17:42:11
【问题描述】:
我尝试在 angularJS 中填写一个选择,但它不起作用,我不明白为什么。 因此,在我的控制器中,我使用 http 请求来填充历史对象的 cShops 属性。我在我的属性上使用 Console.Dir() 来显示内容,并且我的变量很好地填充。所以我尝试使用这个对象列表来填充我的选择标签,但它不起作用,我在 chrome 控制台中没有错误。
使用包含商店列表的属性获取 Historic 的方法:
var reqGetHistEmployees = $http({ url: 'api/Employees/GetHistoryEmployee', params: { 'id': id } });
reqGetHistEmployees.success(function (resolve) {
$scope.histEmployee = resolve;
console.log('histEmployee[0].cShops : ');
console.dir($scope.histEmployee[0].cShops);
});
所以当我验证清单时,商店已经满了。所以我试图在我的 html 中的一个选择中显示这个列表:
Affectations :
<table class="myTable">
<thead style="background-color:#54a0fc !important;">
<tr>
<th>{{'Shop' | i18n}}</th>
<th>{{'Function' | i18n}}</th>
<th>{{'Contract' | i18n}}</th>
<th>{{'Entrance' | i18n}}</th>
<th>{{'Ending' | i18n}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="hist in histEmployee">
<td><select ng-options="shop.Name for shop in hist.cShops track by shop.ShopID"></select></td>
<td>{{hist.FunctionName}}</td>
<td>{{hist.ContractName}}</td>
<td>{{hist.DateOfEntry | date:'shortDate'}}</td>
<td>{{hist.DateOfEnding | date:'shortDate'}}</td>
</tr>
</tbody>
</table>
但我的选择是空的,我在控制台上没有错误,所以我不知道如何解决这个问题。
提前感谢您能给我的任何帮助
【问题讨论】: