Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is difference between $timeout and window.setTimeout in AngularJS?



What is difference between $timeout and window.setTimeout in AngularJS?..

Answer / pintu

$timeout is an Angular service which wraps the browser's window.setTimeout() function into a try/catch block and delegates any exceptions to $exceptionHandler service. It is used to call a JavaScript function after a given time delay. The $timeout service only schedules a single call to the function.

var app = angular.module("app", []);
app.controller("MyController", function ($scope, $timeout) {
$timeout(callAtTimeout, 1000);
});
function callAtTimeout() {
console.log("Timeout occurred");
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

Can you write both angular 1 and angular 2 codes in a single project?

0 Answers  


Explain the difference between angular and angularjs?

0 Answers  


What is the best way to declare and access a global variable in angular 2?

0 Answers  


What is the purpose of a filter in angular?

0 Answers  


Is angular front end or backend?

0 Answers  


What is *ngfor directive used for?

0 Answers  


What are the modules in angularjs?

0 Answers  


What is a factory? What is the difference between service and factory?

0 Answers  


Is it a good or bad practice to use angular js together with jquery?

0 Answers  


Do you know scope in angularjs?

0 Answers  


Explain route configuration?

0 Answers  


How to set headers for every request in angular?

0 Answers  


Categories