Skip to content

Create New Scope element with directive instead of sub directive.  #8

@mbostwick

Description

@mbostwick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions