1.6.0-rc.2: ng-if on select component with an ng-model produces "Cannot read property '$$phase' of null" error #15466
Description
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.