I have a dashboard-like page. Instead of having each component on this
page do it's own request to retrieve the data it needs, the components
build a single request.
Here is a simplified example:
How would this "batchingHttp" service know that all controllers have
asked for the data they need and it can go ahead with the request?
Seems like the same problem?
Speaking of services: Is there any documentation on how services work in 0.10.6?
On Feb 12, 2012, at 6:18 PM, Eric Jain wrote:
> On Sun, Feb 12, 2012 at 15:04, Vojta Jina <vojta...@gmail.com> wrote:
>> I would create a service some "batchingHttp". The controllers would ask for
>> the data they need and this service would join all into a single request and
>> delegate the request to $http service.
>
> How would this "batchingHttp" service know that all controllers have
> asked for the data they need and it can go ahead with the request?
> Seems like the same problem?
Digests happen synchronously so you just need to $defer/setTimeout a callback that executes the batched request and then every controller in the current cycle gets a chance to add something to the batch.
Using $defer appears to work. What's a digest?
How do I get hold of the "scope"?
I tried $rootScope.$evalAsync(f), and that appears to work as well...