title: Is it possible to replace/overwrite a ui-router state definition? (default state being "customized" by another module)
body: <p>Is it possible to simply replace a state definition with a new one?</p>
  
  <p>The use case I have is that one module defines the state, and I'd like to be able to replace that state definition from a different module. Basically the initial definition is a "default" definition, and I'd like to have the possibility to customize the state from a different module.</p>
  
  <p>I realize that doing this at config time could result in a race condition on which module defines it first. I looked into the possibility of doing it at run-time, but couldn't get it working.</p>
  
  <p>I can accomplish what I want by creating entirely new states, but I would like to use the same URL from the original state.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>To further clarify what I am trying to accomplish...
  Please consider the following code:</p>
  
  <pre><code>angular.module('module1', ['ui.router'])
  .config(['$stateProvider', function($stateProvider){
      $stateProvider
          .state('root', {
              url: '',
              abstract: true,
              template: '&lt;div class="layout sub" ui-view="sub"&gt;&lt;/div&gt;'
          })
          .state('root.sub1', {
              url: '/sub1',
              views: {
                  'sub@root': {
                      template: '&lt;p&gt;Default sub state 1&lt;/p&gt;'
                  }
              }
          });
  }]);
  
  angular.module('module2', ['ui.router'])
  .config(['$stateProvider', function($stateProvider){
      $stateProvider
          .state('root.sub1', {
              url: '/sub2',
              views: {
                  'sub@root': {
                      template: '&lt;p&gt;Customized sub state 1&lt;/p&gt;'
                  }
              }
          });
  }]);
  </code></pre>
  
  <p>Which of course gives "Error: State 'root.sub1'' is already defined"</p>