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

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

@sirbarrence

Description

@sirbarrence

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions