angular-repeat-n icon indicating copy to clipboard operation
angular-repeat-n copied to clipboard

Create New Scope element with directive instead of sub directive.

Open mbostwick opened this issue 9 years ago • 0 comments

I'm using your directive for an app but because of how you used scope, I'm not able to use the index on the element with the directive.

i.e you would expect to see 50 lines, but you end up with 100 because of the scoping.

<div ng-repeat-n="100" ng-show="$index < 50">
This index will print {{$index}}
</div>

example: http://jsfiddle.net/qejrsw4n/6/

Its really problematic if your dealing with tables, where you can't just insert spans or divs where ever you want, and where you may want to adjust colspans based on the index. I'm not likely to create a pull request with my results because I broke your code up into easier to read functions.

https://gist.github.com/mbostwick/48f197d0761a7a17bc3e4fdc9221f2a4

mbostwick avatar Feb 07 '17 16:02 mbostwick