Which one handles exception automatically between $digest and $apply?
Answer Posted / 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 |
Post New Answer View All Answers
What is a typescript decorator?
What is a template in angular7?
What are directives in angular?
What is a template angular?
What is scope hierarchy?
Why do we use ngmodel?
What is services and also explain its features in angular 2?
What is one way data binding in angularjs?
How to use the css binding in angular js?
How to use dependency injection (di) correctly in angular 2?
What does ng view do?
What is a promise in angular?
Does bootstrap require jquery?
What are dsl animation functions in angular js. List them.
What Are The Security Features Provided By AngularJS?