top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is difference between $evalAsync and $timeout?

+1 vote
253 views
What is difference between $evalAsync and $timeout?
posted Oct 27, 2017 by Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

$evalAsync - This executes the expression on the current scope on later time. The $evalAsync makes no
guarantees as to when the expression will be executed, only that:
1. If code is queued using $evalAsync from a directive, it will run after the DOM has been manipulated by
Angular, but before the browser renders.
2. If code is queued using $evalAsync from a controller, it will run before the DOM has been manipulated
by Angular and before the browser renders.
$timeout - This also executes the expression on the current scope on later time. When the code is queued using
$timeout, it will run after the DOM has been manipulated by Angular and after the browser renders which may
cause flicker in some cases.

answer Oct 27, 2017 by Shivaranjini
...