title: migrating from ngRoute/$routeProvider to ui-router/$urlRouterProvider
body: <p>I want to start using Angular's ui-router instead of ngRoute. Originally, my app config looked like</p>
  
  <pre><code>myApp.config(["$routeProvider",
      function($routeProvider) {
          $routeProvider
              .when("/search", {
                  templateUrl: "partials/customerSearch.html"
              })
              .when("/home", {
                  templateUrl: "partials/home.html"
              })
              .when("/login", {
                  templateUrl: "partials/login.html",
                  controller:  "LoginCtrl"
              })
              .otherwise({
                  redirectTo: "/home"
              })
          ;
      }
  ]);
  </code></pre>
  
  <p>I swapped out the libraries, and changed the config. I understand I <em>could</em> still use <code>$routeProvider</code>, but that seems like a legacy workaround.</p>
  
  <pre><code>myApp.config(["$urlRouterProvider", "$stateProvider",
      function($urlRouterProvider, $stateProvider) {
          $urlRouterProvider
              .when("/search", "partials/customerSearch.html")
              .when("/home",   "partials/home.html")
              .when("/login",  "partials/login.html")
              .otherwise("/home")
          ;
          $stateProvider
              .state({
                  name:        "customer",
                  url:         "/customer/:username",
                  templateUrl: "partials/customer.html"
              })
              .state({
                  parent:      "customer",
                  name:        "details",
                  url:         "/details",
                  templateUrl: "partials/customerDetails.html"
              })
          ;
  
      }
  ]);
  </code></pre>
  
  <p>This gives me errors that seem to indicate <code>$digest</code> is stuck in a loop. I suspect the <code>.otherwise("/home")</code> rule. Am I specifying the <code>handler</code>s correctly, as if they were template URLs?</p>
  
  <p>If I comment-out the <code>.when()</code>s, nothing works except <code>"/customer/:username"</code>. Do I have to have a state defined for every route? If so, what is the point of having both <code>$urlRouterProvider</code> and <code>$stateProvider</code>? Asked differently, what is each supposed to do?</p>