title: JavaScript | AngularJS | UI-Router: $urlRouterProvider Redirect With Parameters
body: <h3>The Problem...</h3>
  
  <p>The Implementer should have the ability to write simple redirects using <code>$urlRouterProvider.when</code> to invoke another state <em>with the same, expected URL-parameters</em>:</p>
  
  <pre><code>$urlRouterProvider.when('/hook/route', '/that/other/route');
  </code></pre>
  
  <p>This should provide the correct <code>$sateParams</code> needed for the target state. For example, if the URI <code>/hook/route?token=X</code> is called, the target state should have <code>$stateParams.token === 'X'</code> -- given that this parameter <em>is</em> configured within the <code>$stateProvider</code> ({... url: '/that/other/route?token' ...});</p>
  
  <p>The conventional way [in Stackoverflow-land] looks like the following:</p>
  
  <pre><code>$urlRouterProvider
      .when('/hook/route', redirect)
      .otherwise('/');
  
  function redirect($state, $stateParams) {
      $state.go('app.otherState', { token: $stateParams.token });
  }
  </code></pre>
  
  <p>This seems <strong>very</strong> overkill for a simple <em>redirect-with-parameters</em> action -- especially if many redirects are needed.</p>
  
  <p>The answer I'll provide below shows a very-low-overhead approach, which unfortunately, has not been spot-lighted in other StackOverflow threads regarding this topic...</p>