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 to use the angular js $watch?
How old is angular?
What is event distner and host distner in angular?
How to load external css style into angular 2?
Explain currency filter?
What is angular base elements?
How are angularjs prefixes $ and $$ used?
What is a dynamic route in angularjs and how do you implement it?
What are the different types of directives?
What is ngzone used for?
How to debug the $rootscope object of angularjs when in the browser?
Explain bazel?