title: Angular JS - Global variable refreshing issue
body: <p>I am defining a global $rootScope variable like this:</p>
  
  <pre><code>var app = angular.module("demoApp", []);
  app.run(function ($rootScope) {
      $rootScope.test = "Global"; 
  });
  </code></pre>
  
  <p>and in my html if I access this as {{test}} it works.</p>
  
  <p>But in my controller if I change the value of this variable inside my controller and change the location using $location.path(....); then this global variable value remain same.</p>
  
  <pre><code>function myCtrl($location, $rootScope) {
      $rootScope.test = "Changed to Local"; 
      $location.path("New.html");
  }
  </code></pre>
  
  <p>Now in my New.html if I access this variable {{test}} it prints as 'Global' instead of 'Changed to Local'. But if I refresh the page, then it works fine.</p>
  
  <p>Please help how to avoid this refresh issue. Can I use resolve/promise inside the ' app.run.....'? If so how to do it.</p>