我有一个Angular 1.x MVC,设置如下:
...
.controller('orderdetailCtrl', ['$scope', 'orderServer', ..., function($scope, orderServer, ...) {
$scope.refundDetail = function(item) {
orderServer.refundDetailDialog(item).result.then(function(data) {
if(data) {
item.refund_info.refund_balance = data;
}
});
}
$scope.refundEdit = function(item) {
orderServer.refundEditDialog(item).result.then(function(data) {
if (data) item.refund_info.refund_balance = data;
});
}
...
}]).controller('refundDetailDialogCtrl', ['$scope', 'orderServer', ..., function($scope, orderServer, ...) {
...
$scope.cancel = function() {
$modalInstance.close($scope.entity.refund_info.refund_balance);
};
}]).factory('orderServer', [..., function(...) {
return {
refundDetailDialog: function(item) {
return $dialogs.create('/.../xxx.modal.html', 'refundDetailDialogCtrl', item, {
size: "lg"
});
},
refundEditDialog: function(item){
return $dialogs.create('/.../xxx.modal.html', 'refundEditCtrl', item);
}
...
}
}]);现在父页面的设置如下所示:
<tr ng-repeat="details in entity.refundlist">
...
</tr>这里重复的"details“是$scope.refundDetail中的item,现在上面的代码运行得很好。出于好奇,我想知道是否可以将orderServer的promise中的项目替换为当前的"details“范围(意思是替换item.refund_info.refund_balance = data)。
到目前为止,我已经尝试过:
$scope.refund_info.refund_balance = data;
this.refund_info.refund_balance = data;
refund_info.refund_balance = data;
$scope.details.refund_info.refund_balance = data;
this.details.refund_info.refund_balance = data;
details.refund_info.refund_balance = data;这些都不管用。
https://stackoverflow.com/questions/44559316
复制相似问题