0
我有控制所有者json对象,所以我想从中获得工作人员,我如何分配工作人员json对象到$scope.controlOwnerObj.worker
?我如何访问对象数组内的对象?
ctrl.js
if ($state.is('app.editControl')) {
angular.forEach($scope.controlDTO.controlOwners,function(owner){
$scope.selectedOwners = owner
})
// $scope.selectedOwners = $scope.controlDTO.controlOwners[0].worker;
// $scope.controlDTO.controlOwners[0].worker.fullName;
console.log('EDIT CONTROL OWNERS DATA', $scope.selectedOwners);
}
json.js
"controlOwners": [{
"worker": {
"workerKey": -1093,
"sourceFeed": null,
"statusLookUpCode": null,
"externalId": null,
"createdUserText": null,
"createdTimestamp": null,
"modifiedUserText": null,
"modifiedTimestamp": null,
"stdId": "ZK84T1N",
"ccId": null,
"empClasId": null,
"deptId": null,
"fullName": "Rajasekaran, Shanmuga",
}
}],
如果我想显示工作人员名单,那么索引将无法正常工作? – hussain
然后你遍历数组,'angular.forEach()'或'Array#forEach' – Vaelyr
我是新来的angularJS我增加了angular.forEach代码你可以看看它是否正确我还没有得到工作列表 – hussain