【发布时间】:2016-02-04 07:16:24
【问题描述】:
说,我有如下嵌套资源,
shallow do
resources :aalu do
resources :pyaj
end
end
使用restangular,我使用以下Restangular 调用获得所需的资源
all_pyaj = Restangular.one('aalu', $stateParams.aaluId).all('pyaj').getList();
pyaj 是 all_pyaj 数组的一个元素,我使用 ng-repeat 得到它。
现在,当我想使用 remove() 方法使用 Restangular 删除资源时,
pyaj.remove() 对 /aalu/:aalu_id/pyaj/:pyaj_id 进行 DELETE 调用
我希望它对 /pyaj/:pyaj_id 进行 DELETE 调用,并从角度 $scope 中删除资源。
我可以通过以下方式实现,
Restangular.one('pyaj', payj.id).remove().then(
function (response) { /* Problem: Delete this pyaj from $scope */ }
我可以让 Restangular 对 /pyaj/:pyaj_id 进行 DELETE 调用并从 angular $scope 中删除资源吗?
Restangular 如何处理浅层路线?
【问题讨论】:
标签: ruby-on-rails angularjs restangular