Which one handles exception automatically between $digest and $apply?
Answer / swati maheshwari
$apply handle exceptions.
scope.$digest() will only fire watchers on current scope, scope.$apply will evaluate passed function and run $rootScope.$digest().
First one is faster, as needs to evaluate watchers for current scope, second one is slower (needs to evaluate watchers for$rootScope and all it's child scopes).
When error occurs in one of the watchers and you use scope.$digest, it's not handled via $exceptionHandler service, so you need to handle exception yourself. scope.$apply uses try catch block internally and passes all exceptions to $exceptionHandler.
| Is This Answer Correct ? | 2 Yes | 0 No |
How would you update angular 6 to angular 7?
Define data binding.
What are ngModel and how do we represent it?
Can you explain spa architecture in angularjs?
What are differences between constructors and oninit?
What is pathmatch in angular routing?
What selector forces a style down through the child component tree into all the child component views?
How to use ng-if/else in angular js?
What is router outlet ></ router outlet?
How do you reference the host of a component?
What is ng build?
Please explain package.json file in angular?