问题
I'm trying to get access to $first of a ngRepeat parent from within a nested ngRepeat. Is there a way to alias or access $first for use within nested ngRepeat? I've tried $parent.$first, but it doesn't appear to work. Outputting to screen by interpolation indicates it has the same value as the $first of the nested child.
$parent.$first // same value as nested child
回答1:
Yeesh, you have to go up two-levels to access the ngRepeat parent directive:
$parent.$parent.$first
来源:https://stackoverflow.com/questions/26875437/angularjs-access-to-first-of-ngrepeat-parent-in-a-nested-ngrepeat