I am trying to setup a limit on my slides, as it stands i have added data-ng-repeat="job in jobs | limitTo : 10"
i noticing 12 slides are still displaying. Is there something incorrect my code for this function not to work Plunkr
var timer;
$scope.startAuto = function() {
timer = $interval(function(){
$scope.jobNotification = ($scope.jobNotification + 1) % $scope.jobs.length;
}, 5000);
};
$scope.isActive = function (index) {
return $scope.jobNotification === index;
};
$scope.showJobNotification = function (index) {
if (timer){
$interval.cancel(timer);
$scope.startAuto();
}
$scope.jobNotification = index;
};
$scope.stopAuto = function() {
console.log('tickCtrl.stopAuto() triggered');
if(timer) {
$interval.cancel(timer);
timer = undefined;
}
}
You need to limit the jobNotification value. Reducing the modulo to 10 prevents slide 11 and 12 from ever showing.
$scope.jobNotification = ($scope.jobNotification + 1) % 10;