Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Indeed, you should use directives, and there is no event tied to the end of a ng-Repeat loop (as each element is constructed individually, and has it's own event). But a) using directives might be all you need and b) there are a few ng-Repeat specific properties you can use to make your "on ngRepeat finished" event.</p> <p>Specifically, if all you want is to style/add events to the whole of the table, you can do so using in a directive that encompasses all the ngRepeat elements. On the other hand, if you want to address each element specifically, you can use a directive within the ngRepeat, and it will act on each element, after it is created.</p> <p>Then, there are the <code>$index</code>, <code>$first</code>, <code>$middle</code> and <code>$last</code> properties you can use to trigger events. So for this HTML:</p> <pre><code>&lt;div ng-controller="Ctrl" my-main-directive&gt; &lt;div ng-repeat="thing in things" my-repeat-directive&gt; thing {{thing}} &lt;/div&gt; &lt;/div&gt; </code></pre> <p>You can use directives like so:</p> <pre><code>angular.module('myApp', []) .directive('myRepeatDirective', function() { return function(scope, element, attrs) { angular.element(element).css('color','blue'); if (scope.$last){ window.alert("im the last!"); } }; }) .directive('myMainDirective', function() { return function(scope, element, attrs) { angular.element(element).css('border','5px solid red'); }; }); </code></pre> <p>See it in action in this <a href="http://plnkr.co/edit/or5mys?p=preview">Plunker</a>. Hope it helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload