title: How to access $rootScope value defined in one module into another module
body: <p>I need to understand "<em>How can I access the value of $rootScope value defined in one module into other module?</em>"</p>
  
  <p>Below is my code :</p>
  
  <p><em>Index.html</em></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html ng-app="myapp"&gt;
  
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"&gt;  &lt;/script&gt;
  &lt;link rel="stylesheet" href="style.css"&gt;
  &lt;script src="script.js"&gt;&lt;/script&gt;
  &lt;script src="test.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;div ng-controller="serviceDIController"&gt;
  Service Values is : &lt;b&gt; {{sdiParam}} &lt;/b&gt;  &lt;br/&gt;
  Factory Values is : &lt;b&gt; {{fdiParam}} &lt;/b&gt;  &lt;br/&gt;
  Root Scope Values is : &lt;b&gt; {{rootParam}} &lt;/b&gt;  
  &lt;/div&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><em>script.js</em></p>
  
  <pre><code>var app = angular.module("myapp", ['testModule']);
  
  app.controller('serviceDIController',['$scope','$rootScope',
  'testService','testFactory',function($scope, $rootScope,testService, testFactory) 
  {
  
   $scope.sdiParam = testService.param;
   $scope.fdiParam = testFactory.fparam;
  // $scope.rootParam = $rootScope.root;      // How to access "$rootScope.root" value defined in test.js in current module inside a controller?
  
  }
  ]);
  </code></pre>
  
  <p><em>test.js</em></p>
  
  <pre><code>var testapp = angular.module("testModule", []);
  
    testapp.service('testService', function() {
    this.param = "Service Param1 DI";
  });
  
  testapp.factory('testFactory', function() {
  
    var fact = {};
    fact.fparam = "Fact Param1 DI";
    return fact;  
  });
  
  testapp.controller('testCtrl', ['$scope',
    function($rootScope) {
      $rootScope.root = "Root Scope Param1";
    }
  ]);
  </code></pre>
  
  <p>Live demo : <a href="http://plnkr.co/edit/X0aamCi9ULcaB63VpVs6?p=preview" rel="nofollow noreferrer">http://plnkr.co/edit/X0aamCi9ULcaB63VpVs6?p=preview</a></p>
  
  <p>Checked below example but did not work:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/23814190/angularjs-rootscope-variable-exists-but-not-accessible">AngularJS $rootScope variable exists, but not accessible</a></li>
  </ul>