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

Is it possible to have two ng-app directives for a single angular application?

864


What is activatedroute in routes?

863


Is angular easy to learn?

705


How to create angularjs filter which outputs html?

783


What is sse?

815


What is routerstatesnapshot in angular?

813


how to set a custom header on the request?

787


Format date time in angular js?

751


What are some security-related features built into the angular framework?

774


What is decorator in angular?

763


What is ngstyle and ngclass?

800


what is angular expression?

805


What is the difference between ngoninit and ngafterviewinit?

766


How to handle 'loading chunk failed' error in angularjs application?

826


Can we have nested controllers in AngularJS?

869