I wonder if it's ok to use $rootscope
this way?
$scope.buscaChamados = function() { modelSac.buscaChamados() .success(function(data, res) { $rootScope.chamadosSistema = data; }); }
I wonder if it's ok to use $rootscope
this way?
$scope.buscaChamados = function() { modelSac.buscaChamados() .success(function(data, res) { $rootScope.chamadosSistema = data; }); }
I believe you are referring to good practices. If this is the case, I imagine that what you want to do (share data with other scopes) can be best implemented via service
(or, alternatively, a factory
).
In several implementations, $ rootScope is reserved for use as a pipeline for global broadcasts.