What is the difference between $watch and $observe?
Answer Posted / chaitanya
$watch is a method on the scope object which is used to watch expressions. The expression can be either strings or functions.
$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.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Why $scope is used in angularjs?
What are template expressions in angular?
What are the features of angular 2 service?
What is injector?
Can't bind to ngmodel since it isn't a known property of input angular?
What is aot in angular?
What are the features of angularjs?
What is a decorator function?
What is another word for module?
What are the differences between @component and @directive?
Which directive is used to hide elements from the html dom by removing them from that dom and not changing their styling?
What is the use of a double-click event in angularjs?
Why is lazy evaluation good?
Explain ngfor directive with an example?
How angular protects us from xss attacks?