title: AngularJS $rootScope variable exists, but not accessible
body: <p>I set a $rootScope variable in one of my modules and now want to access that same $rootScope variable in another module. Thus far I can see that in both modules the variable has been set properly, but when I try accessing the variable in $rootScope, I only get undefined.</p>
  
  <p>How can I access this variable without doing a factory/service workaround? The variable is really simple and $rootScope should suffice for what I need. I've put some generic sample code below to illustrate the issue:</p>
  
  <p>file1.js</p>
  
  <pre><code>var app = angular.module('MyApp1', []);
  
  app.controller('Ctrl1', ['$scope', '$rootScope', function($scope, $rootScope) {
      $scope.myFunc = function() {
          $rootScope.test = 1;
      }
  }
  </code></pre>
  
  <p>file2.js</p>
  
  <pre><code>var app = angular.module('MyApp2', []);
  
  app.controller('Ctrl2', ['$scope', '$rootScope', function($scope, $rootScope) {
      $scope.need_to_access_this = $rootScope.test; // undefined
      console.log($rootScope); // returns JS object w/ test property set to 1
  }
  </code></pre>