When I Use Angularjs Ng-repeat, It Doesn't Show What I Append In Javascript
In HTML, I want to display multiple rows of items(tasks timeline). In each row, gantt-items,gantt-days is used to plot 365 small boxes which are presented 36
Solution 1:
It happens because the elements in the ng-repeat
directive appear after the DOM compiling.
Try using $watch
:
$scope.$watch('items.entities', function(){
for(var i = 1; i < 366; i++){
$(".gantt-item ul.gantt-days").append('<li class="gantt-day" style="width: 25px"><span style="line-height: 35px; height: 35px">' + year + "-" + d.getMonth() + "-" + d.getDate() + '</span></li>');
d = new Date(d.getTime() + (24 * 60 * 60 * 1000));
}
});
Post a Comment for "When I Use Angularjs Ng-repeat, It Doesn't Show What I Append In Javascript"