0

I have an ng-repeat that is populated with the data from the back end .

<div ng-repeat = "data in Helper.data" class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
  <div class="easy-pie-chart txt-color-orangeDark" data-percent="33" data-pie-size="50">
    <span class="percent percent-sign">{{((data.doc_count/data.size)*100)|number:0}}</span>
  </div>
  <span class="easy-pie-title"> @{{data.key|uppercase}} <i class="fa fa-caret-up icon-color-bad"></i> </span>
    <ul class="smaller-stat hidden-sm pull-right">
      <li>
        <span class="label bg-color-greenLight"><i class="fa fa-caret-up"></i> {{((data.doc_count/data.size)*100)|number:0}}%</span>
      </li>
     <li>
       <span class="label bg-color-blueLight"><i class="fa fa-caret-down"></i> 44%</span>
     </li>
   </ul>
   <div class="sparkline txt-color-greenLight hidden-sm hidden-md pull-right" data-sparkline-type="line" data-sparkline-height="33px" data-sparkline-width="70px" data-fill-color="transparent">
                  130, 187, 250, 257, 200, 210, 300, 270, 363, 247, 270, 363, 247
   </div>
</div>

In the above code , we have the easyPieChart directive (should be a wrapper Easy Pie Chart , I got it with a template ) which should show the Pie chart once the ng-repeat completes . But for some reason , it's not working as expected . May be the easyPieChart directive is compiled before the ng-repeat completes . How do I solve this ??

Please Help

Rajeshwar
  • 2,290
  • 4
  • 31
  • 41
32teeths
  • 1,469
  • 1
  • 15
  • 32
  • I believe that the ng-repeat is compile when all the others directives are compile. so maybe to late for you. You could embed the ng-repeat inside your directive or use transclusion. – Raulucco Mar 04 '15 at 09:15
  • @Raulucco: Sorry cant get you , How do I embed ng-repeat inside the directive . Actually the directive is on an element one way down the element on which ng-repeat is defined – 32teeths Mar 04 '15 at 09:24
  • with transclusion or writing the ng-repeat inside the template of your directive https://docs.angularjs.org/api/ng/directive/ngTransclude – Raulucco Mar 04 '15 at 09:26
  • Actually it's not my directive , and code containing its definition is minified .I was thinking of creating a second directive that $scope.apply()'es after the ng-repeat is created . But i dont know how to do it . – 32teeths Mar 04 '15 at 11:13
  • OK, so you can set the priority of your directive higher than the ng-repeat that is 1000 http://stackoverflow.com/questions/19270392/what-is-priority-of-ng-repeat-directive-can-you-change-it. At this point a plunker could be of great help. https://docs.angularjs.org/api/ng/service/$compile – Raulucco Mar 04 '15 at 11:18
  • I cannot make any modification's to the directive like changing its priority , What I can and is trying to do is to create a third directive . – 32teeths Mar 04 '15 at 11:30
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/72221/discussion-between-32teeths-and-raulucco). – 32teeths Mar 04 '15 at 11:57
  • why cant create a directive that runs when ng-repeat finishes rendering , you can put that piechart script in that .will that work? – Mukul Jayaprakash Jun 27 '15 at 05:30

0 Answers0