$rootScope not working?

.controller('AppCtrl', function($scope, $rootScope, $ionicLoading) {
  $rootScope.colorg = 'blue';
})

.controller('CategoriasCtrl', function($scope, Categorias, $ionicLoading, $rootScope) {
  console.log($rootScope.colorg);
})

Because the console.log returns undefined me?

Problem solved, I had not assigned the Controller as the main index.html .
It was enough to set → ng -controller = " AppCtrl "