title: How to use Angularjs to dynamically set spinner after table row bound
body: <p>I'm updating the table via an ajax call, and want to display a spin.js spinner while the row.status == pending. 
  Basically I have a row fragment that successfully toggles from  </p>
  
  <pre><code> &lt;div class="spinner"&gt; 
  </code></pre>
  
  <p>to  </p>
  
  <pre><code> &lt;div class="hide"&gt;  
  </code></pre>
  
  <p>as the row computation progresses, (via ajax within a controller).
  I'm happy with any mechanism that works! 
  What I'm struggling to do is, when the value is </p>
  
  <pre><code> &lt;div class="spinner"&gt;
  </code></pre>
  
  <p>have a spinner showing, otherwise have it hidden.</p>
  
  <pre><code>        &lt;table class="table table-hover"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;url&lt;/th&gt;
                      &lt;th&gt;status&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;                 
                  &lt;tr data-ng-repeat="row in result.results"&gt;
                      &lt;td&gt;{{row.link.url}}&lt;/td&gt;
                      &lt;td&gt; &lt;div loadingWidget class="{{(row.status == 'pending' ? 'spinner' : 'hide' ) }}"&gt;&lt;/div&gt;{{row.status}}&lt;/td&gt;
                  &lt;/tr&gt;                   
              &lt;/tbody&gt;
          &lt;/table&gt;
  </code></pre>
  
  <p>My latest script - basically I don't really know what I'm doing, </p>
  
  <pre><code>app.directive('loadingWidget', function ($rootScope) {
      return {
          restrict: 'E',
          scope: {
              field: '=',
              attributes: '=',
              editMode: '='
          },
  
          link: function (scope, element, attrs) {
              scope.spinit = function() {
                  $rootScope.$broadcast('spinit');
              }
          }
      };
  });
  
  $scope.$on('spinit', function(element){
      //react to event
      new Spinner().spin(element);
  });
  </code></pre>