Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error because of ng-repeat in angularjs

Tags:

angularjs

i used nested ng-repeat to display my data in html page.

it is throwing an error

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

but this error doesn't affect my functionality.i was searching for an answer for this problem but i didn't get the correct answer thats y i posted this question here.

i didn't know whether my json data structure causes this error, but i can't change its structure.

here is my sample json data

    //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 tel me what causes this error and how to resolve it?

like image 981
JSAddict Avatar asked Nov 30 '25 14:11

JSAddict


1 Answers

That JSON is not valid. Also, your template is not going to output anything visible unless you put some bind tags in the repeater like {{ Company.Company.id }} for example.

like image 71
Jignesh.Raj Avatar answered Dec 03 '25 14:12

Jignesh.Raj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!