I am trying to figure out how to call a function on the last iteration of an ng-repeat? I am using nested ng-repeats to display results in table format and would like to call a function after all the table cells are loaded.
I was trying to do something like this:
<tr ng-repeat="(rowIndex, rowResults) in chunkedResults">    
    <td ng-repeat="result in rowResults">
        <canvas id="item{{rowIndex}}{{$index}}"></canvas>
        <div>Canvas{{rowIndex}}{$index}}</div>
    </td>
    <div ng-if="$last" ng-init="loadCanvases()"></div>
</tr>
But with nested ng-repeats this does not seem to work. When there is only one ng-repeat present like so:
<tr>    
    <td ng-repeat="result in rowResults">
        <canvas id="item{{$index}}"></canvas>
        <div>Canvas{$index}}</div>
        <div ng-if="$last" ng-init="loadCanvases()"></div>
    </td>
</tr>
Then the function gets called on the last iteration as it should.
Any ideas why?
 
     
     
    