title: angular-ui-router: how to clear and reconfigure states?
body: <p>I am dynamically loading my states (based on a server call) in <code>app.run</code>.
  <code>window.$stateProviderRef</code> is just a reference to <code>$stateProvider</code> set on the window object in <code>app.config(..)</code></p>
  
  <pre><code>app.run(function($http) {
      $http.get('/api/states').
          success(function(data, status, headers, config) {
  
              angular.forEach(data, function(state) {
                  window.$stateProviderRef.state(state.name, { url: state.url, templateUrl: state.templateUrl) : state.templateUrl });
              });
  
          });
  
  });
  </code></pre>
  
  <p>Is it possible to somehow clear or reload the state configuration? So that previous states aren't valid and new states loaded?</p>