$interval(function() {
var count = $scope.announcements.length;
for(var i=0;i<count;i++) {
if($scope.announcement == $scope.announcements[i].description) {
if(i==count-1) {
$scope.announcement = $scope.announcements[0].description;
if($scope.announcement.length >= 100) {
$scope.readmore = true;
$scope.short_ann = $scope.announcement.substr(0,85);
}
break;
} else {
$scope.announcement = $scope.announcements[i+1].description;
if($scope.announcement.length >= 100) {
$scope.readmore = true;
$scope.short_ann = $scope.announcement.substr(0,85);
}
break;
}
}
}
}, 5000);
An animation is wanted to accompany the update of $scope.announcement every 5 seconds when changing ng-bind.