【发布时间】:2015-03-23 07:46:07
【问题描述】:
我有 2 个资源:项目及其任务。 当用户需要更新项目时,他们可能会更新标题,也可以更新其任务。
如果用户创建一个任务,需要先将它保存到数据库中才能取回id,然后我可以将id分配给项目的tasks属性。
因此需要在保存所有任务后保存项目。
$scope.update = function() {
//each taskTemplate can be updated concurrently, or at the same time. they do not need to updated one by one
for (var taskTemplates in $scope.taskTemplates) {
//i need to update all the tasks, and then I can update the project
}
//this needs to be update after all the taskTemplates are updated
$scope.projectTemplate.$update(function() {
$location.path('projectTemplate/' + $scope.projectTemplate._id)
}, function(errResponse) {
$scope.error = errorResponse.data.message
})
}
如何实现这样的排序?
【问题讨论】:
标签: angularjs node.js ngresource