0

i have a directive that injects a high amount of data on a high-chart that iterates using ng-repeat over an object's attributes:

<div class="row animated fadeIn" ng-repeat="datum in controllerData" ng-if="(SizeOf(controllerData) > 0 && !dataInLoad)">....</div>

now.. having this usually injecting at least 5-8 charts, it gets the explorer stuck for about 20-40 seconds.

now i know there are ways to split ng-repeat if iterating over strings or arrays but my app requires that i iterate over this object's attributes (controllerData).

is there a way to control over the ng-repeat such that it will load only a couple of charts every time and only then continue?

thank you

Shahaf Stein
  • 165
  • 2
  • 14

1 Answers1

0

how about this. https://docs.angularjs.org/api/ng/filter/filter . This will give new array for according to your expression.

splitData = _.filter(array, function(data){ return array.id==1});

this will split the data which has attribute id == 1 into a seperate array.

Ranjith Kumar
  • 75
  • 1
  • 9
  • dont quite understand how this will do – Shahaf Stein Feb 22 '16 at 12:43
  • you want to iterate the array with object attribute right? splitData = _.filter(array, function(data){ return array.id==1});. This will do it. – Ranjith Kumar Feb 22 '16 at 12:50
  • more like i have an object with a lot of attributes, each attribute holds an object of the same type. and i need to do something like ng-repeat using limitTo on this object. besides, do i need underscore.js to use what you suggusted? – Shahaf Stein Feb 23 '16 at 07:51