title: How to redirect url by query parameters in angularjs?
body: <p>I'm using <code>ngRoute</code> in <code>angularjs</code> to delegate different html templates, eg:</p>
  
  <pre><code>phonecatApp.config(['$routeProvider',
    function($routeProvider) {
      $routeProvider.
        when('/phones', {
          templateUrl: 'partials/phone-list.html',
          controller: 'PhoneListCtrl'
        }).
        when('/cars', {
          templateUrl: 'partials/car-detail.html',
          controller: 'CarDetailCtrl'
        });
  
      //many more routes
    }]);
  </code></pre>
  
  <p>Problem: I want to have a common url, like <code>localhost/my-app?myparam=Nokia</code>.</p>
  
  <p>I want to compare the <code>myparam</code> to a mapping table. If the param name is a phone company, I want to delegate to <code>/phones</code>. If it's a car company, I want to delegate to <code>/cars</code>, etc. You get the idea.</p>
  
  <p>Also I have to rewrite the url as follows: <code>localhost/myapp/phones?myparam=Nokia</code>. Thereby the ngRoute would automatically catch the correct template and controller.</p>
  
  <p>Question: how can I intercept the initial loading, and redirect based on the url param?</p>
  
  <p>Sidenote: I cannot rewrite the routeProvider config eg by using a different plugin like <code>angular-ui-router</code>.</p>