javascript - infinite promises in ngResource -


i implementing rest calls in ngresource. created code end point as.

var resource = $resource('/api/orders/:id');  // list of orders  function getorders(limit, page, designfields){   // query params   var params = {     limit: limit,     page: page,     designfields : designfields   }    var deferred = $q.defer();    resource.query(params, function(result){     deferred.resolve(result);   },function(error){     deferred.reject(error);   });    return deferred.promise; } 

i consuming above in controller follows.

var orders = api.orders.getall(10,1); orders   .then(function(result){       console.log(result);     });   }).catch(function(err){     console.log(err); }); 

but thing can't response following spits out in console. there promises inside every promise. confused why it's not working.

enter image description here


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -