I have a directive with an isolate-scope (so that I can reuse the directive in other places), and when I use this directive with an ng-repeat
, it fails to work.
Without directly trying to avoid answering your questions, instead take a look at the following fiddle:
http://jsfiddle.net/dVPLM/
Key point is that instead of trying to fight and change the conventional behaviour of Angular, you could structure your directive to work with ng-repeat
as opposed to trying to override it.
In your template:
In your directive:
template:
' ' +
' - ' +
' ' +
' {{$index}} - {{name.first}} {{name.last}}' +
' ' +
'
' +
'
'
In response to your questions:
ng-repeat
will create a scope, you really shouldn't be trying to change this.