Angularjs ng-repeat error

I have used nested ng-repeat to display my data in the html page.

it throws an error

Error: Error: 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations

      

but this error does not affect my functionality. I was looking for an answer to this problem, but I didn't get the right answer, so I posted this question here.

I didn't know if my json data structure is causing this error, but I cannot change its structure.

here is my example json data p>

    //In controller
for (var i = 1; i <= 31; i++) {
$scope.daysofmonth.push({day:i});    // daysofmonth.day->1,2,3...
}
for(var j=0; j<$scope.daysofmonth.length; j++) {
$scope.daysofmonth[j].events = [     // creating 31 arrays for events
    {"name":"T", "count":0,"data":[{
         "startDate":"01/25/2013",
         "startTime":"00:00",
         "endDate":"01/26/2013",
         "endTime":"00:00",
         "type":"m",
         "status":"Not Started",
         "title":"Demo to Client",
         "description":"Application demo"
             }]},
    {"name":"I", "count":0,"data":[...]} // same as previous
    ];
 //left some of the business logic
}

    //In html file
    <div class="{{box | today:year+'-'+month+'-'+dayofmonth.day:dayofmonth.day}}"  ng-repeat="dayofmonth in daysofmonth" >
    <span class="days">{{ dayofmonth.day }}</span>
    <span class="events-list">
            <div ng-repeat="eve in dayofmonth.events" >   
                {{ eve.count + eve.name }} 
        </div>
    </span>
    </div>

      

Can anyone please advise me what is causing this error and how to resolve it?

+3


source to share


3 answers


That JSON is not valid. Also, your template will not render anything visible unless you put some anchor tags in a relay for example {{ Company.Company.id }}

.



+1


source


This could be because you are initializing objects in views inside ng-repeat. I had a similar problem because of this. See this link



Error: 10 $ digest () fighters reached. Aborting! with dynamic sorting predicate

0


source


As others have pointed out, the data is invalid. While it may be valid JSON, it is not valid javascript. I hacked into a data structure based plunker example sanitized with valid javascript and I have no ng repetitions nested errors.

Of course, there are only two of them, since everything you mentioned in your code snippet above. But it works great with those two, and should work equally well with additional nested repeats.

http://plnkr.co/edit/z36YclsngdX9HozgdUkQ?p=preview

0


source







All Articles