Skip to content
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
@g00fy-

Description

@g00fy-

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) 
}); 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions