title: ng-repeat in custom directive: Syntax Error: Token '$index' is unexpected
body: <p>In AngularJS, this fails with an error:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;my-directive ng-repeat="foo in foos" foo="foo" my-index="{{$index}}"/&gt;
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>Error: [$parse:syntax] Syntax Error: Token '$index' is unexpected, expecting [:] at column 3 of the expression [{{$index}}] starting at [$index}}].
  </code></pre>
  
  <p>Here's the directive:</p>
  
  <pre class="lang-js prettyprint-override"><code>app.directive('myDirective', function() {
      return {
          restrict: 'E',
          scope: { foo: '=', myIndex: '=' },
          templateUrl: 'directives/myDirective.html'
      };
  });
  </code></pre>
  
  <p>This only appears to be an issue with custom directives. If I try this:</p>
  
  
  
  <pre><code>&lt;div ng-repeat="foo in foos" style="padding: {{$index}}px;"&gt;
      index == {{$index}}
  &lt;/div&gt;
  </code></pre>