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?

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


Please Help Members By Posting Answers For Below Questions

What is the use of restrict and template property when creating custom directives?

891


Is angular difficult?

751


What are the form validations supported by angularjs?

774


What is angular controllers?

785


What is ngmodel in angular?

853


Is angular a oop?

743


What is angularjs and what are some of its advantages?

803


What is data binding in angular?

854


What a digest cycle is in angularjs?

747


What is angular cli? List the command to install angular cli?

843


What is interceptor in angular?

769


How to bootstrap your angular app for multiple modules?

1355


What are the methods available in $http ?

904


What is angular 5? Whats new in it?

861


Explain $q service, deferred and promises.

809