Hi Rob,
As Kyle said, you probably have a minor typo:
try promise without the $:
$q.all([group.promise, task.promise]).then(function (results) { r = results;
...
Regards
Justin
On Wednesday, 19 November 2014 20:05:35 UTC+2, Rob 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?
>
>
--
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.