I´m using AngularJS 1.1.3 to use the new $resource with promises...
How can I get the callback from that? I tried the same way I did with $http :
$re
var MyResource = $resource("/my-end-point/:action", {}, {
getSomeStuff: { method:"GET", params: { action:"get-some-stuff" }, isArray: true },
getSingleThing: { method:"GET", params: { action:"get-single-thing" }, isArray: false }
});
function MyController(MyResource) {
var itemList = MyResource.getSomeStuff({}, function success() {}, function err() {});
// will call: /my-end-point/get-some-stuff
// will be array. each object is resource's instance
var item = MyResource.getSingleThing({id:123}, function success() {}, function err() {});
// will call: /my-end-point/get-single-thing?id=123
// will be object. an instance of resource
}
Also check out the example in docs: ngResource