title: Is there a way to pass the scope to a directive templateUrl: function?
body: <p>I have a directive that I'm calling with in a loop.  Each item in the loop has a FieldTypeId attribute, and depending on the value of FieldTypeId, I want to swap out the URL of the template.  I feel that this is a better and polymorphic approach rather than doing an ng-switch statement in the html.  </p>
  
  <pre><code>&lt;div ng-repeat="item in attributes"&gt;
    &lt;div attribute-input&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Of course, the <code>$scope</code> isn't available in this directive:</p>
  
  <pre><code>editStudentAccountModule.directive('attributeInput', function () {
          return {
              restrict: "AE",
              templateUrl: function () { // 
                 var attribute = $scope.attributes[$scope.$index];
                 if (attribute.FieldTypeId == 1) {
                   return '../Templates/dropdown.html';
                 } else if (attribute.FieldTypeId == 2) {
                   return '../Templates/radio.html';
                 } // etc.
              }
          }
      });
  </code></pre>