Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Which one handles exception automatically between $digest and $apply?



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

Post New Answer

More AngularJS Interview Questions

Write the cli command to generate a component in angular 4?

0 Answers  


Explain ng-bind and ng-bind-html directives.

0 Answers  


What is $rootscope in angularjs? How is it different from the scope?

0 Answers  


What is transpiling?

0 Answers  


What is the latest version of angular?

0 Answers  


What's new in angular 6? What are improvements in angular 6?

0 Answers  


What is auto bootstrap process in AngularJS?

0 Answers  


What is difference between $document and window.document in AngularJS?

1 Answers  


What are angular filters?

0 Answers  


What is the factory method in angularjs?

0 Answers  


What classes should I not add to module's declarations in angular 4?

0 Answers  


What is ng init?

0 Answers  


Categories