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

1.6.0-rc.2: ng-if on select component with an ng-model produces "Cannot read property '$$phase' of null" error #15466

Closed
joewolschon opened this issue Dec 2, 2016 · 0 comments

Comments

@joewolschon
Copy link

joewolschon commented Dec 2, 2016

Do you want to request a feature or report a bug?

Report a bug.

What is the current behavior?
Current behavior is that using ng-if on select input with an ng model produces the following console error:

    angular.js:14290TypeError: Cannot read property '$$phase' of null
    at Object.$$debounceViewValueCommit (angular.js:28509)
    at Object.$setViewValue (angular.js:28490)
    at Array.<anonymous> (angular.js:31800)
    at Scope.$digest (angular.js:17815)
    at Scope.$apply (angular.js:18030)
    at HTMLButtonElement.<anonymous> (angular.js:26642)
    at defaultHandlerWrapper (angular.js:3579)
    at HTMLButtonElement.eventHandler (angular.js:3567)

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).

Repro
View the following plunkers with the dev console open and click the "Toggle ng-if on select" button:

1.6 rc 2 behavior (broken): https://plnkr.co/edit/EhBpLWbKrHTadmSsRjKZ?p=preview
Produces error noted above.

1.5.9 behavior (no error): https://plnkr.co/edit/PH4sJl65DlseChiMEcUy?p=preview
No error.

What is the expected behavior?
I would expect ng-if on a select input to not produce a console error.

What is the motivation / use case for changing the behavior?

Appears to be a bug unless I haven't processed #13286 or the various select input changes properly.

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

This seems to be an issue in all browsers, is present in the latest 1.6x version, and is not present in the latest 1.5.x version.

Other information (e.g. stacktraces, related issues, suggestions how to fix)

It looks like this is likely related to the change from
$rootScope.$$phase to this.$$scope.$root.$$phase located here in the #13286 PR.

@joewolschon joewolschon changed the title ng-if on select component with an ng-model produces "Cannot read property '$$phase' of null" error 1.6.0-rc.2: ng-if on select component with an ng-model produces "Cannot read property '$$phase' of null" error Dec 2, 2016
@gkalpak gkalpak added this to the 1.6.0 milestone Dec 2, 2016
@gkalpak gkalpak self-assigned this Dec 2, 2016
gkalpak added a commit to gkalpak/angular.js that referenced this issue Dec 3, 2016
gkalpak added a commit to gkalpak/angular.js that referenced this issue Dec 3, 2016
gkalpak added a commit to gkalpak/angular.js that referenced this issue Dec 5, 2016
@gkalpak gkalpak closed this as completed in 7a667c7 Dec 6, 2016
ellimist pushed a commit to ellimist/angular.js that referenced this issue Mar 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants