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


Please Help Members By Posting Answers For Below Questions

What is ngonchanges in angular 2?

482


Does apple use angular?

467


What is primeng in angular?

484


Explain $q service, deferred and promises.

510


What is elementref in angular 4?

543






How did you reverse a string?

481


What is an oauth token?

474


What the link function is and how it differs from compile?

509


What is angular cli command?

449


How to display images based on the status(a, b, and c) in angular js?

498


What is pipe in angular?

570


What is ngoninit in angular?

490


What is a controller javascript?

494


What would be a good use for ngzone service?

519


What do you understand by linking function? Explain its type.

452