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 httpinterceptor in angular?

842


Explain the steps for creating a services in angular 2?

742


Can multiple controllers be used in a single html page?

769


Explain data binding in angular 4?

776


How would you make use of onnginit()?

879


What is single page application in angularjs?

748


What is an oauth token?

751


Explain npm?

793


What is the new in angular 7?

761


What is factory method in angular.js?

723


What is difference between component and module in angular?

812


What are ngModel and how do we represent it?

769


What does pipe do in rxjs?

748


Explain the difference between promise and observable in angular?

775


Is angular 2 mobile oriented?

707