diff --git a/modules/angular1_router/src/ng_route_shim.js b/modules/angular1_router/src/ng_route_shim.js index 6cb817148b..ba15c575ef 100644 --- a/modules/angular1_router/src/ng_route_shim.js +++ b/modules/angular1_router/src/ng_route_shim.js @@ -150,7 +150,7 @@ }]; // we resolve the locals in a canActivate block - componentDefinition.$canActivate = function() { + componentDefinition.controller.$canActivate = function() { var locals = angular.extend({}, routeCopy.resolve); angular.forEach(locals, function(value, key) { diff --git a/modules/angular1_router/test/integration/lifecycle_hook_spec.js b/modules/angular1_router/test/integration/lifecycle_hook_spec.js index ec49c9d563..915740bc14 100644 --- a/modules/angular1_router/test/integration/lifecycle_hook_spec.js +++ b/modules/angular1_router/test/integration/lifecycle_hook_spec.js @@ -466,10 +466,10 @@ describe('Navigation lifecycle', function () { } if (options.$canActivate) { - factory.$canActivate = options.$canActivate; + controller.$canActivate = options.$canActivate; } if (options.$routeConfig) { - factory.$routeConfig = options.$routeConfig; + controller.$routeConfig = options.$routeConfig; } $compileProvider.directive(name, factory); diff --git a/modules/angular1_router/test/integration/navigation_spec.js b/modules/angular1_router/test/integration/navigation_spec.js index 7213995943..ab4853f212 100644 --- a/modules/angular1_router/test/integration/navigation_spec.js +++ b/modules/angular1_router/test/integration/navigation_spec.js @@ -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); } diff --git a/modules/angular1_router/test/integration/router_spec.js b/modules/angular1_router/test/integration/router_spec.js index 25e15bb236..3e5a96c24e 100644 --- a/modules/angular1_router/test/integration/router_spec.js +++ b/modules/angular1_router/test/integration/router_spec.js @@ -181,7 +181,7 @@ describe('router', function () { if (options.template) definition.template = options.template; if (options.templateUrl) definition.templateUrl = options.templateUrl; - applyStaticProperties(definition, options); + applyStaticProperties(definition.controller, options); angular.module('testMod').component(name, definition); }