Hi all, I was reading this thread<http://stackoverflow.com/questions/16739084/angularjs-using-rootscope-as-a-data-store> :
Having used angular for all of 3 days, I came to the same conclusion as the author -- using root scope to store my state. Others replying suggest using a service to cache state in order to avoid using the root scope. Though this sounds like an alternative, my concerns with a custom service to store states are: 1) Repeating data: My controller would have to copy this from the caching service to the $scope on each invocation. I may have thousands of items that I don't necessarily want to 'copy' from this 'cache service' into the scope (this is a heavy weight app). 2) More coupling: Each time more user input state is added (i.e sorting, filter etc) I need to catch that update to the model and store it in the cache service too. I'd also have to modify the controller so that on subsequent invocations that additional cached state was again reflected in the $scope (re implement 2 way binding, but this time between controller and service!) -- is there some easier way to achieve this that I'm missing? In essence I'm concerned that another service, though avoiding the use of root scope, would be worth the additional maintenance burden. Warm regards, PJ. -- 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.
