Interviews - C# Corner

Sanwar Ranwa
What is the difference between the $watch, $digest, and $apply?
By Sanwar Ranwa in Angular onFeb 03 2018
  • Tripat Bala Singh
    Mar, 2018 6

    $watch() : - $scope.$watch() function is used to watch change in variable on the $scope. $watch() function have three parameter first one is expression second one is listener and last one is equality$digest() : - $scope.$digest() function iterates all the watch in the $scope object and its child object also. when $digest() iterates over the watches it checks if the value of expression has changed. calls the change callback(listener) with the new value and the old value$apply() :- The $scope.$apply function take a function as a parameter which is executed and after that $scope.$digest is called internally. That make easier to make sure that all watch are checked and thus all data binding refreshed.

    • 2
  • prem prakash
    Feb, 2018 6

    Hope this link help u http://www.dotnettricks.com/learn/angularjs/understanding-angularjs-watch-digest-and-apply

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS