I need to trigger an event once all the iterations in this nested loop are completed. While I can use $last to check for the last iteration, I am unable to determine within the inner loop if it is at the $last iteration of the parent loop. Here's what I have:
<div>
<div ng-repeat="filter in filters.filters" repeat-directive-one filter="filter" update-filter="updateFilter">
</div>
</div>
Inside the repeat-directive-one looks like this:
<div ng-repeat="item in filter.values | limitTo: filter.showMore ? filter.values.length : '5' track by $index" repeat-directive-two value="::item" update-filter="updateFilter" ng-if="!$last"></div>
<div ng-repeat="item in filter.values | limitTo: filter.showMore ? filter.values.length : '5' track by $index" repeat-directive-two value="::item" update-filter="updateFilter" ng-if="$last" checkbox-fix></div>
This setup adds the checkbox-fix directive when it reaches the last item of the inner loop. However, this fires multiple times if the outer loop has fewer items than the inner one. I would like something like:
ng-if="$last && parent.$last"
But this logic doesn't seem to work as expected. I also tried passing the parent $last boolean as a isolated scope attribute (in repeat directive one):
<div ng-repeat="filter in filters.filters" repeat-directive-one filter="filter" update-filter="updateFilter" last-property="$last">
However, logging $scope.lastProperty returns nothing. Is there a way to pass down a flag indicating that the parent loop is at its $last iteration? Any suggestions would be appreciated. Thank you!