Interviews1 answer
What is Difference $timeout and $interval in angularjs ?
1 Answer
$timeout- $timeout is used to call a function and schedules a single call to the function . It calls another java script function after a certain time.
Example -
$scope. Show = function() {
alert("Hii");
}
$timeout( function(){
$scope.show();
}, 5000);
$interval-$interval is used to call a function and schedules repeated calls to the function . It calls another java script function after a certain time.
$scope. Show = function() {
alert("Hii");
}
$interval( function(){
$scope.Show();
}, 5000);
Puneet KankarPosted Jul 29, 2017, 2:47 AM EDT
