This is my original plunker demo http://plnkr.co/edit/9UBZ9E4uxAo1TXXghm1T?p=preview .
For div 4(ng-if=”show==4″) When the list is empty i want to hide the particular div, currently each div is shown for a interval of 5 seconds, any inputs?As we are showing each div based on $interval, need to modify the js code to hide the div if the detailsList==0
.
JS code:
app.controller('MainController', function($scope, $rootScope, $interval) {
$scope.show = 1;
$rootScope.detailsList = 0;
$interval(function() {
if ($scope.show === 4) {
if ($rootScope.detailsList < 2) {
++$rootScope.detailsList;
} else {
$rootScope.detailsList = 0;
$scope.show = 1;
}
} else if ($scope.show < 4) {
++$scope.show;
} else {
$scope.show = 1;
}
}, 5000, 0);
});
Source: AngularJS
from Angular Questions https://angularquestions.com/2017/10/17/js-code-to-skip-the-interval/
via @lzomedia #developer #freelance #web #lzomedia.com
No comments:
Post a Comment