title: In Angular, can view be loaded in code?
body: <p>Very simply, after an API call, depending on the return value, how is the appropriate view loaded?  Consider having</p>
  
  <pre><code>search.html
  views/found.html
  views/notfound.html
  </code></pre>
  
  <p>Search's controller makes an AJAX call to a service and gets a good or bad result.  Now I want the appropriate view to load, without user having to click.  I just can't figure out how to do this and have looked at scores of routing/view examples.  I'm using HTML5 mode.</p>
  
  <pre><code>app.config(['$routeProvider', '$locationProvider',
  function ($routeProvider, $locationProvider) {
      $routeProvider
          .when('/', {
              templateUrl: 'search.html',
              controller: 'searchCtrl'
          })
          .when('found', {
              templateUrl: 'views/found.html',
              controller: 'foundCtrl'
          })
          .when('notFound', {
              templateUrl: 'views/notFound.html',
              controller: 'notFoundCtrl'
          })
          .otherwise({
              templateUrl: 'search.html',
              controller: 'searchCtrl'
          });
  
      $locationProvider.html5Mode({
          enabled: true,
          requiredBase: true
      });
  </code></pre>
  
  <p>And in the controller ..</p>
  
  <pre><code>$scope.post = function (requestType, requestData) {
      var uri = 'Search/' + requestType;
      $http.post(uri, requestData)
          .success(function (response) {
              $scope.searchResult.ID = response.ID;
              $scope.searchResult.Value = response.Value;
              // how is the view/route loaded without a user click?
              'found';
              return true;
          }).error(function (error) {
              // how is the view/route loaded without a user click?
              'notFound';
              return false;
          });
  </code></pre>
  
  <p>I'm just lost after getting back the response on how to invoke a view within the template.</p>