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 |
List the types of data binding supported by angular 5?
In angular what is string interpolation?
How to enable lazy loading?
What are angular js expressions?
Explain what directives are? Mention some of the most commonly used directives in angularjs application?
What is patchvalue used for?
What angular js routes does?
Why you will do ngondestroy after subscrib?
How can we setting up our development environment for angular 2?
What is typings in angular 2?
Explain angularjs digest cycle?
What is the core difference between angularjs compilation and javascript frameworks?