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.

safeApply should work on scopes where $root is not set #147

Open
@RaviDesai

Description

@RaviDesai

There are some cases where I have a $scope variable where $root is not set: it isn't set in root scopes, and is not guaranteed in non-isolate scopes more info here- http://stackoverflow.com/questions/22216441/what-is-the-difference-between-scope-root-and-rootscope).

In these cases safeApply will fail to operate correctly due to this line: https://github.com/Reactive-Extensions/rx.angular.js/blob/master/src/safeApply.js#L14. I would like to see this line to be rewritten as:

($scope.$$phase || ($scope.$root && $scope.$root.$$phase)) ?
            onNext(data) :
            $scope.$apply(function () { onNext(data); });

or something similar so it would not fail incorrectly in these cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions