After a lot more debugging I believe this doesn't really have anything to 
do with the $q.all. I boiled everything down to simplified code and put it 
on plunkr.

http://plnkr.co/edit/bScT0mlzOgY5Dx2rzcmf?p=preview

The real issue seems to come from the sequence how things are getting 
executed. If you run that code you see the following sequence of popup 
messages:

Before menuCtrl
After menuCtrl
menuCtrl loaded

What I expected is:

Before menuCtrl
menuCtrl loaded
After menuCtrl

How can I assure the controller has been loaded before the html is being 
loaded? Alternatively, is there a way to get the kendo menu to 
automatically update once the data from the controller becomes available?

On Wednesday, November 19, 2014 7:08:52 PM UTC-8, Kyle Cordes wrote:

> On Wed, Nov 19, 2014 at 12:05 PM, Rob <[email protected] <javascript:>> 
> 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.

Reply via email to