I have requirement where i need to share data between controllers,so i created factory
suppose i have url like: abc/123 (Note:123 is dynamic i need to pass it from controller)
MyCode
appServices.factory('classesService', function($http){
return {
getClasses: function(value) {
return $http.get(urlprefix + 'orgs/' + value + '/classes?with-users=true');
}
};
});
In Controller
classesService.getClasses($scope.organization.id).then(function(data){});
now suppose i am using it in 3 contollers 3 calls will go to server. i dont want three calls i want only one call.
Note:value is same for all three controller
is there any way i can acheive this.
Thanks