AngularJS access to $first of ngRepeat parent in a nested ngRepeat

放肆的年华 提交于 2019-12-23 18:22:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!