我正在使用Task.query().then(blah)
提取所有“任务”的列表,我希望在运行该init
函数之前运行它。
如何推迟查询功能的运行?
答案 0 :(得分:0)
$scope.init = function(taskableId, taskableType, currentUserId) {
$scope.task = {};
$scope.task.taskableId = taskableId;
$scope.task.taskableType = taskableType;
$scope.task.creatorId = currentUserId;
TaskResource.query({taskable_id: $scope.task.taskableId, taskable_type: $scope.task.taskableType}).then(function(result){
$scope.tasks = result.reverse();
});
};