title: Accessing $rootScope content in factory return undefined
body: <p>I am puzzled. </p>
  
  <p>First, i observe this in Ionic 1+ (but i assume this is probably related to AngularJS)</p>
  
  <p>I created a factory, with the $rootScope injected.</p>
  
  <p>In my app.js, i have assigned a variable, says </p>
  
  <pre><code> var app = angular.module('my-module',
       app.run(['$rootScope', ...
  
           $rootScope.strUrl = 'http://localhost:30000'
  </code></pre>
  
  <p>Then i need to use this variable inside the factory. Precisely, access it just after it is loaded.</p>
  
  <pre><code> angular.module('my-module')
          .factory('myFactory', ['$rootScope', ...]);
   function myFactory($rootScope, ...){
       var objUrl = {
                       baseUrl: $rootScope.strUrl,
                       ....
       }
   }
  </code></pre>
  
  <p>What puzzles me is that, when i access $rootScope.strUrl inside the factory, it returns undefined. However, just one line before that, i am able to <code>console.log($rootScope.strUrl)</code> which returns exactly the string i want.</p>
  
  <p>Is it not possible to access the $rootScope content inside the factory?</p>