title: Angularjs - dynamic template URL
body: <p>I have a directive which I would like to be able to load a different template on some logic. </p>
  
  <p>In the example below, the 'type' is a variable on the scope which I would like to pass to the directive to build the URL for the directive's template.</p>
  
  <pre><code>&lt;direct type="{{type}}"&gt;&lt;/direct&gt;
  
  var direct = function () {
    return {
    restrict: 'E',
    templateUrl: function(tElement, tAttrs) {
      console.log(type);
      return 'resources/' + tAttrs.type + '.html';
    }
   };
  };
  </code></pre>
  
  <p>The type is not being evaluated but instead the actual string 'type' is being passed in the tAttrs. Do you know what I might be missing out?</p>