Billy,

You need to take a look at resolve, and there are some other techniques 
available too to make this work.
While there is nothing wrong with using $timeout to defer code outside the 
digest circle, the way you are using it is
plain wrong. 
Let me explain a bit, a async operation like $http does not make any 
guarantee when it comes back. If you are working locally
on your own machine, it gives fair odds the data will be in in the next 
digest cycle. However, if it takes only a few milliseconds more to fetch,
 the $timeout will miss it. If you put this in production, it will have a 
much higher miss rate, as data needs to travel over the network!

I have this sample <http://goo.gl/JOk7CK>in where there are multiple ways 
to work around this. Have a look at it, and if you have questions,
don't hesitate to ask.

Regards
Sander

-- 
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