.directive('firstDirective', function (myService){ return { controller: function ($scope) { myService.getData().then(function (data) { $scope.myData = data; }); } }}).directive('secondDirective', function (myService){ return { controller: function ($scope) { myService.getData().then(function (data) { $scope.myData = data; }); } }});Hi André
Well, if your directives use separate pieces of data, the syncing isn’t a issue to begin with, and keeping the state out of the data is enough right?
Otherwise make sure the service takes care of the syncing. Keep the cache in the service, and hand out references in stead of copies.
You can do something like myService.getData({start:1, end:10}) and so on.
Regards
Sander
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/FWYpwl_H6t0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.