top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between $watch and $observe?

0 votes
351 views
What is the difference between $watch and $observe?
posted Oct 27, 2017 by Latha

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

1 Answer

0 votes

$watch is a method on the scope object which is used to watch expressions. The expression can be either
strings or functions. It can be called wherever you have access to scope (a controller or a directive linking
function).
$observe is a method on the attrs object which is only used to observe the value change of a DOM attribute. It is
only used inside directives.
Note - All $observes and $watches are checked on every digest cycle.

answer Oct 27, 2017 by Shivaranjini
...