Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

DigestObserver does not check root scope $$phase before digesting #141

Open
sirbarrence opened this issue May 23, 2016 · 1 comment
Open

Comments

@sirbarrence
Copy link
Contributor

When using DigestObserver via scope.$digestObservable() it's possible to trigger

Error: [$rootScope:inprog] $apply already in progress
http://errors.angularjs.org/1.5.5/$rootScope/inprog?p0=%24apply
    at angular.js:68
    at beginPhase (angular.js:17587)
    at Scope.$digest (angular.js:17025)
    at Scope.$apply (angular.js:17337)
    at DigestObserver.next (rx.angular.js:566)
    at DigestObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (rx.all.js:1752)
    at DigestObserver.tryCatcher (rx.all.js:63)
    at AutoDetachObserverPrototype.next (rx.all.js:11781)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (rx.all.js:1752)
    at InnerObserver.next (rx.all.js:5582)(anonymous function)

if the the scope that $digestObservables() was invoked on was not digesting but the root scope was digesting.

This is because unlike all the other rx.angular code that tries to invoke Scope.$apply, DigestObserver only checks $scope.$$phase and not $scope.$root.$$phase to decide whether to invoke the property setter immediately or to schedule it with Scope.$apply().

Angular: 1.5.5
rx-angular: 1.1.3

@sirbarrence
Copy link
Contributor Author

Will resubmit pull request to fix this once #144 is merged so the build will pass.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant