This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ngResource interceptor ambiguity : callback invoked with promise or value #6731
Closed
Description
Line https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L562
invokes success callback with either explicit response object or promise.
This is inconsistent as sometimes
// posts may be array of ngResource or promise
Post.query(function(posts){ $scope.posts = posts })
and
// posts are always array of ngResource
$scope.posts =Post.query()
IMHO it should be
$q.when(value).then(function(value){
(success||noop)(value, response.headers)
});