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 |
Explain the use of ng-if, ng-switch, and ng-repeat directives in angularjs?
What is class in typescript?
What is a module in a course?
How to catch and log specific angular errors in your app?
How to do animation in angularjs?
Mention what are the styling form that model adds to css classes?
Explain what is scope in angularjs?
Ln component and service which logic that we have to write?
What is primeng in angular?
What is the benefit of angular?
Is angularjs dependent on jquery?
What is the basic need to start with AngularJS?