Okay, so I had to actually write a service for the cache to see how it does 
make a lot of sense.  Good points.

Actually, another free advantage i got out of adding a caching service was 
that I can avoid scope.apply()... which I was having to use because the 
updates to the scope were not emanating from angular.  Now since I am 
building up the model on the scope from another source, that goes away too 
which makes things neater.

On the amount of data on the scope, you are right.  I'm just copying all 
data: $scope.component { xyz = cache.component.xyz}, but now I have a great 
place to be selective when needed.

Thanks a bundle. 
PJ



On Thursday, March 27, 2014 6:50:38 AM UTC, Antonio Fernández Porrúa wrote:
>
> 1. The values are not copied, just referenced.
>
> 2. You should not use your scope as your model, and you do not need to.
> Put in the scope only the things needed in the view, neither more nor less.
> This way there are less values to check.
>
> 3. Your service could be just a javascript empty object, where you store 
> anything you want.
>
> angular.module(foo).service('bar',function(){ return this; });
>
> Then in your controler
>
> If(bar.baz === undefined){
> bar.baz = $scope.baz
> }
> $scope.baz = bar.baz
>
> If baz is an array or an object this will work fine, so you can use an 
> object to store strings and numbers
>
>

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