Using $ rootscope AngularJs

3

I wonder if it's ok to use $rootscope this way?

$scope.buscaChamados = function() {
                        modelSac.buscaChamados()
                          .success(function(data, res) {
                            $rootScope.chamadosSistema = data;
                          });
                       }
    
asked by anonymous 21.07.2015 / 18:59

1 answer

4

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.     

22.07.2015 / 20:41