test(angular_1_router): apply annotations to controller constructors

Until Angular 1.5.1 is released, the `$routeConfig` and `$routerCanActivate`
annotations for components must live on the controller constructor.

In Angular 1.5.1, it will automatically copy these annotations across from
the component definition file.

Closes #7319
This commit is contained in:
Peter Bacon Darwin
2016-02-25 13:09:31 +00:00
committed by Pete Bacon Darwin
parent 83f0e7c975
commit 7f22bd62ab
4 changed files with 8 additions and 7 deletions

View File

@ -306,14 +306,15 @@ describe('navigation', function () {
}));
function registerDirective(name, options) {
var controller = getController(options);
function factory() {
return {
template: options.template || '',
controllerAs: name,
controller: getController(options)
controller: controller
};
}
applyStaticProperties(factory, options);
applyStaticProperties(controller, options);
$compileProvider.directive(name, factory);
}
@ -323,7 +324,7 @@ describe('navigation', function () {
template: options.template || '',
controller: getController(options),
}
applyStaticProperties(definition, options);
applyStaticProperties(definition.controller, options);
$compileProvider.component(name, definition);
}