On Wed, Nov 19, 2014 at 12:05 PM, Rob <[email protected]> wrote: > I have two queries on resources and try to process the data once both > queries have been finished. I tried to do this with the following code: > > var groupRes = $resource(baseUrl + "group/" + ":Id", { Id: "@Id" }, {}); > var group = groupRes.query(); > var taskRes = $resource(baseUrl + "task/" + ":Id", { Id: "@Id" }, {}); > var task = taskRes.query(); > > var r, e; > $q.all([group.$promise, task.$promise]).then(function (results) { r = > results; > }, function (error) { e = error; > }); > > However, neither of my two functions for $q.all(..).then(...) are being > called and both r and e stay undefined. > > When I do a 'then' on just one of the promises everything works as > expected. > > task.$promise.then(function (result) { .... > > How can I get this to work with $q.all? > >
Your code looks correct-ish, but human eyes and brains are notoriously bad at determining code correctness. I suspect there is some minor typo-bug - if you put this demonstration of the problem in a plunkr, someone will likely spot it. -- Kyle Cordes http://kylecordes.com -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
