diff --git a/src/ng/compile.js b/src/ng/compile.js index fbbb32025595..70facd9e56f9 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1106,6 +1106,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { forEach(options, function(val, key) { if (key.charAt(0) === '$') { factory[key] = val; + controller[key] = val; } }); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index cb2279aa305e..6ad592f91ef5 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -10044,6 +10044,22 @@ describe('$compile', function() { })); }); + it('should add additional annotations to the controller constructor', function() { + var myModule = angular.module('my', []).component('myComponent', { + $canActivate: 'canActivate', + $routeConfig: 'routeConfig', + $customAnnotation: 'XXX' + }); + module('my'); + inject(function(myComponentDirective) { + expect(myComponentDirective[0].controller).toEqual(jasmine.objectContaining({ + $canActivate: 'canActivate', + $routeConfig: 'routeConfig', + $customAnnotation: 'XXX' + })); + }); + }); + it('should return ddo with reasonable defaults', function() { angular.module('my', []).component('myComponent', {}); module('my');