2
I have an object I’d like to share with others Controllers
, thought of two ways, the first would be to use $rootScope
and in the other use a Service
. I chose the second way and created the following service:
AuditoriaAPP.factory('Service', function() {
var Service = {
solicitacoes: {}
};
return Service;
});
In the 1st Controller, which is where my object is that I want to share:
Service.solicitacoes = solicitacao;
So far so good, the object is assigned successfully and I can recover it in the 2nd Controller
:
$scope.solicitacoes = Service.solicitacoes;
The problem is that when I refresh the page the object becomes empty. How can I communicate between these Controllers
without the object being empty when refreshing the page?