title: How do I dynamically load a template based on parameters in a route registered with $routeProvider?
body: <p>I found that you can use template or templateUrl as a function like that</p>
  
  <pre><code>.when('/:controller/:action',{
     templateUrl:function(params){
       return: '/'+params.controller+'/'+params.action
    }
  })
  </code></pre>
  
  <p>And then I wondered if it's possible lazy load the template, but I can't make that work</p>
  
  <pre><code>.when('/:ctrl/:action',{
     template:function(params){
        injector = angular.injector(['ng']);
        $q = injector.get('$q');
        var dfrd = $q.defer();
  
        // fetch template from server
        // dfrd.resolve()
  
        return dfrd.promise;      
     }
  });
  </code></pre>
  
  <p>Tell me please there's a way - I want to fetch entire template by making ajax request to the server</p>