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

When latest angularjs was released?

884


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

893


What is router imports?

964


How can a number of watchers and digest cycle time affect the performance of the application?

857


List the types of data binding supported by angular 5?

835


What is binding in java?

768


What is single page application (spa)?

856


How to using looping through a collection for each item in angular js?

899


What is the template in angularjs?

841


How will you show/hide buttons and enable/disable buttons conditionally?

968


Explain service worker in reference to angular js?

901


What are directives in angular7?

896


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

966


What is event binding in angular?

883


Write all the steps to configure an angular app(ng-app).

872