What is difference between $evalAsync and $timeout?



What is difference between $evalAsync and $timeout?..

Answer / Sarvesh Raghuvanshi

Both $evalAsync and $timeout are used for delaying the execution of code, but they have some differences:n
1. $timeout: It accepts a number as an argument specifying the time duration in milliseconds and then executes the provided function after that specified time. The $timeout service returns a promise that gets resolved when the timeout period ends.n
2. $evalAsync: It is part of the $rootScope service, which executes the given function asynchronously without any delay. It does not accept a time argument like $timeout. Unlike $timeout, $evalAsync does not return a promise.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What are the advantages of using angular.js framework?

1 Answers  


How to catch and log specific angular errors in your app?

1 Answers  


Why use node.js?

1 Answers  


What is pipe in rxjs?

1 Answers  


What are controllers in AngularJS?

1 Answers  


What is the meaning of aot?

1 Answers  


What is a good use case for ngrx/store?

1 Answers  


Explain the architecture of angular 2?

1 Answers  


What is deep linking in angular js?

1 Answers  


Explain system.config.ts file used in angular?

1 Answers  


What is the difference between a link and compile in angular?

1 Answers  


Can angularjs connect to database?

1 Answers  


Categories