Skip to content
This repository has been 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 opened this issue Jul 8, 2016 · 0 comments
Open

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

RaviDesai opened this issue Jul 8, 2016 · 0 comments

Comments

@RaviDesai
Copy link

RaviDesai commented Jul 8, 2016

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.

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