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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how we can create module and using it in AngularJS?

814


Mention what are the characteristics of “scope”?

694


What is pure pipe in angular?

709


What is the singleton pattern?

737


How many types of ngmodule?

746


How to using looping through a collection for each item in angular js?

801


What does three dots mean in angular?

795


Explain ng-controller directive ?

775


What is the use of a double-click event in angularjs?

774


What are the types of linking function?

777


What is angular @ routeparams?

747


Explain AngularJS scope life-cycle?

1584


How prevents html dom based cross site scripting (xss) attacks?

786


What is shadow dom? How is it helping angular 2 to perform better?

756


What is directives in angular 2?

752