fix($compile): don't throw if controller is named
This commit is contained in:
+2
-1
@@ -1124,7 +1124,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
forEach(options, function(val, key) {
|
||||
if (key.charAt(0) === '$') {
|
||||
factory[key] = val;
|
||||
controller[key] = val;
|
||||
// Don't try to copy over annotations to named controller
|
||||
if (isFunction(controller)) controller[key] = val;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -10509,6 +10509,17 @@ describe('$compile', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should support custom annotations if the controller is named', function() {
|
||||
var myModule = angular.module('my', []).component('myComponent', {
|
||||
$customAnnotation: 'XXX',
|
||||
controller: 'SomeNamedController'
|
||||
});
|
||||
module('my');
|
||||
expect(function() {
|
||||
inject(function(myComponentDirective) {});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('should return ddo with reasonable defaults', function() {
|
||||
angular.module('my', []).component('myComponent', {});
|
||||
module('my');
|
||||
|
||||
Reference in New Issue
Block a user