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() {...}); }); ```
gkalpak
left a comment
There was a problem hiding this comment.
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 |
mgol
left a comment
There was a problem hiding this comment.
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
windowThis also removes the likewise deprecated
$controllerProvider.allowGlobals()method.Closes #15349
BREAKING CHANGE:
The option to instantiate controllers from constructors on the global
windowobjecthas 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.