title: AngularJS regex route for similar url to load different controller and view
body: <p>I have a similar route that should load a different view and controller based on whether or not the parameter is a number. Example:</p>
  
  <ul>
  <li><code>/artists/2</code> should <code>ArtistsIndexController</code> with a view <code>/www/artists/index.html</code></li>
  <li><code>/artists/name</code> should <code>ArtistsProfileController</code> with a view <code>/www/artists/profile.html</code></li>
  </ul>
  
  <p>Ideally I would use something like:</p>
  
  <pre><code>$routeProvider.when("/artists/:page", {
    templateUrl: "/www/artists/index.html",
    controller: "ArtistsIndexController"
  });
  
  $routeProvider.when("/artists/:name", {
    templateUrl: "/www/artists/profile.html",
    controller: "ArtistsProfileController"
  });
  </code></pre>
  
  <p>Where <code>:page</code> is a number and <code>:name</code> is not.</p>
  
  <p>Note I see a related <a href="https://github.com/angular/angular.js/issues/918" rel="nofollow noreferrer">github issue</a> (found from <a href="https://stackoverflow.com/questions/12685085/angularjs-route-how-to-match-star-as-a-path">this question</a>) but am wondering if there is a resolution or preferred solution.</p>