title: how to call $rootScope variable inside config function - angular
body: <p>i have a value inside $rootscope and i want to access this value inside the config function  , this is my code : </p>
  
  <pre><code>--run function 
  myApp.run(function ($rootScope) {
  
  $rootScope.myVariable = "my value";
  
  });
  
  
  --config function
  
  
  
  myApp.config(['$provide','$routeProvider','$stateProvider','$urlRouterProvider',function($provide,$routeProvider,$stateProvider,$urlRouterProvider) {
  
      // here ,i want to access to myVariable value to do some tests
          $urlRouterProvider.otherwise(function($injector){
  
              var $state = $injector.get('$state');
              var $rootScope = $injector.get('$rootScope');
  
                 alert($rootScope.myVariable == "1");
  
              if ($rootScope.myVariable) {
                  $state.go('mystat1'); 
              }
              else {
                   $state.go('mystat2');   
              }
  
          });
  
       }]);
  </code></pre>
  
  <p>any idea how to achieve this.</p>
  
  <p>thanks in advance</p>