This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.3k
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Controller decorators broken in 1.3 #9839
Copy link
Copy link
Closed
Description
This code used to work in Angular 1.2.x, which we use to resolve some dependencies for our controllers that need to be resolved dynamically.
angular.module('TestApp', []).config(function($provide) {
$provide.decorator('$controller', function($delegate) {
return function(expression, locals) {
locals = _.extend(locals, MY_CUSTOM_LOCALS);
}
return $delegate(expression, locals);
};
}
);
})
This can be fixed by passing in the private later, ident
parameters, but since these are undocumented, this valid use case breaks without no notice. Also the error is extremely unhelpful:
TypeError: object is not a function
at http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:7594:13
at forEach (http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:343:20)
at nodeLinkFn (http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:7593:11)
at compositeLinkFn (http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:6991:13)
at publicLinkFn (http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:6870:30)
at http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular-ui-router/release/angular-ui-router.js:3336:9
at invokeLinkFn (http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:8111:9)
at nodeLinkFn (http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:7623:11)
at compositeLinkFn (http://localhost:9000/95bcabadceecdd8826e2615bcb4572c1c2d52628/app/vendor/bower_components/angular/angular.js:6991:13)
at publicLinkFn
Metadata
Metadata
Assignees
Labels
No labels