-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($controller): remove the option to instantiate controllers from c… #15762
Conversation
…onstructors on `window` This also removes the likewise deprecated `$controllerProvider.allowGlobals()` method. Closes angular#15349 BREAKING CHANGE: The option to instantiate controllers from constructors on the global `window` object has been removed. Likewise, the deprecated `$controllerProvider.allowGlobals()` method that could enable this behavior, has been removed. This behavior had been deprecated since AngularJS v1.3.0, because polluting the global scope is bad. To migrate, remove the call to $controllerProvider.allowGlobals() in the config, and register your controller via the Module API or the $controllerProvider, e.g. ``` angular.module('myModule', []).controller('myController', function() {...}); angular.module('myModule', []).config(function($controllerProvider) { $controllerProvider.register('myController', function() {...}); }); ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also a section in the phonecat tutorial that refers to global controllers. It is not exactly clear what it refers to (does it refer to allowGlobals
or a hypothetical non-AngularJS app that defines controllers as globals), but it is weird enough and maybe could be removed along with allowGlobals()
.
Either way LGTM (as long as Travis si happy).
Thanks for the reviews - also feel free to re-start stalled Travis tests ;) We should probably remove the section about global controllers from the tutorial. |
I've removed the section about global controllers from the tutorial, PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removed tutorial section was also using manual construction that bypasses the DI so it was really bad anyway.
This also removes the likewise deprecated `$controllerProvider.allowGlobals()` method. Closes angular#15349 Closes angular#15762 BREAKING CHANGE: The option to instantiate controllers from constructors on the global `window` object has been removed. Likewise, the deprecated `$controllerProvider.allowGlobals()` method that could enable this behavior, has been removed. This behavior had been deprecated since AngularJS v1.3.0, because polluting the global scope is bad. To migrate, remove the call to $controllerProvider.allowGlobals() in the config, and register your controller via the Module API or the $controllerProvider, e.g. ``` angular.module('myModule', []).controller('myController', function() {...}); angular.module('myModule', []).config(function($controllerProvider) { $controllerProvider.register('myController', function() {...}); }); ```
…onstructors on
window
This also removes the likewise deprecated
$controllerProvider.allowGlobals()
method.Closes #15349
BREAKING CHANGE:
The option to instantiate controllers from constructors on the global
window
objecthas been removed. Likewise, the deprecated
$controllerProvider.allowGlobals()
method that could enable this behavior, has been removed.
This behavior had been deprecated since AngularJS v1.3.0, because polluting the global scope
is bad. To migrate, remove the call to $controllerProvider.allowGlobals() in the config, and
register your controller via the Module API or the $controllerProvider, e.g.