2015-08-20 17:26:57 -04:00
|
|
|
'use strict';
|
|
|
|
|
2015-08-31 18:53:37 -04:00
|
|
|
describe('navigation', function () {
|
2015-08-20 17:26:57 -04:00
|
|
|
|
|
|
|
var elt,
|
|
|
|
$compile,
|
|
|
|
$rootScope,
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter,
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
$compileProvider;
|
2015-08-20 17:26:57 -04:00
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
module('ng');
|
|
|
|
module('ngComponentRouter');
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
module(function (_$compileProvider_) {
|
|
|
|
$compileProvider = _$compileProvider_;
|
2015-08-20 17:26:57 -04:00
|
|
|
});
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
inject(function (_$compile_, _$rootScope_, _$rootRouter_) {
|
2015-08-20 17:26:57 -04:00
|
|
|
$compile = _$compile_;
|
|
|
|
$rootScope = _$rootScope_;
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter = _$rootRouter_;
|
2015-08-20 17:26:57 -04:00
|
|
|
});
|
|
|
|
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('userCmp', {
|
2016-02-10 19:59:26 -05:00
|
|
|
template: '<div>hello {{userCmp.$routeParams.name}}</div>',
|
|
|
|
$routerOnActivate: function(next) {
|
|
|
|
this.$routeParams = next.params;
|
|
|
|
}
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
});
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('oneCmp', {
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
template: '<div>{{oneCmp.number}}</div>',
|
|
|
|
controller: function () {this.number = 'one'}
|
|
|
|
});
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('twoCmp', {
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
template: '<div>{{twoCmp.number}}</div>',
|
|
|
|
controller: function () {this.number = 'two'}
|
2015-08-20 17:26:57 -04:00
|
|
|
});
|
2016-01-31 10:35:23 -05:00
|
|
|
registerComponent('threeCmp', {
|
|
|
|
template: '<div>{{$ctrl.number}}</div>',
|
|
|
|
controller: function () {this.number = 'three'}
|
|
|
|
});
|
2016-02-07 17:09:06 -05:00
|
|
|
registerComponent('getParams', {
|
|
|
|
template: '<div>{{$ctrl.params.x}}</div>',
|
|
|
|
controller: function () {
|
|
|
|
this.$routerOnActivate = function(next) {
|
|
|
|
this.params = next.params;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
})
|
2015-08-20 17:26:57 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should work in a simple case', function () {
|
|
|
|
compile('<ng-outlet></ng-outlet>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/', component: 'oneCmp' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect(elt.text()).toBe('one');
|
|
|
|
});
|
|
|
|
|
2016-01-31 10:35:23 -05:00
|
|
|
|
|
|
|
it('should work with components created by the `mod.component()` helper', function () {
|
|
|
|
compile('<ng-outlet></ng-outlet>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
2016-01-31 10:35:23 -05:00
|
|
|
{ path: '/', component: 'threeCmp' }
|
|
|
|
]);
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/');
|
2016-01-31 10:35:23 -05:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect(elt.text()).toBe('three');
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-08-20 17:26:57 -04:00
|
|
|
it('should navigate between components with different parameters', function () {
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/user/:name', component: 'userCmp' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
compile('<ng-outlet></ng-outlet>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/user/brian');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
expect(elt.text()).toBe('hello brian');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/user/igor');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
expect(elt.text()).toBe('hello igor');
|
|
|
|
});
|
|
|
|
|
|
|
|
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
it('should reuse a parent when navigating between child components with different parameters', function () {
|
|
|
|
var instanceCount = 0;
|
|
|
|
function ParentController() {
|
|
|
|
instanceCount += 1;
|
|
|
|
}
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('parentCmp', {
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
template: 'parent { <ng-outlet></ng-outlet> }',
|
|
|
|
$routeConfig: [
|
|
|
|
{ path: '/user/:name', component: 'userCmp' }
|
|
|
|
],
|
|
|
|
controller: ParentController
|
|
|
|
});
|
2015-08-20 17:26:57 -04:00
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/parent/...', component: 'parentCmp' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
compile('<ng-outlet></ng-outlet>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/parent/user/brian');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
expect(instanceCount).toBe(1);
|
2015-08-20 17:26:57 -04:00
|
|
|
expect(elt.text()).toBe('parent { hello brian }');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/parent/user/igor');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
expect(instanceCount).toBe(1);
|
2015-08-20 17:26:57 -04:00
|
|
|
expect(elt.text()).toBe('parent { hello igor }');
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should work with nested outlets', function () {
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('childCmp', {
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
template: '<div>inner { <div ng-outlet></div> }</div>',
|
|
|
|
$routeConfig: [
|
|
|
|
{ path: '/b', component: 'oneCmp' }
|
|
|
|
]
|
|
|
|
});
|
2015-08-20 17:26:57 -04:00
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/a/...', component: 'childCmp' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
compile('<div>outer { <div ng-outlet></div> }</div>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/a/b');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect(elt.text()).toBe('outer { inner { one } }');
|
|
|
|
});
|
|
|
|
|
2016-01-27 15:05:34 -05:00
|
|
|
it('should work when parent route has empty path', inject(function ($location) {
|
|
|
|
registerComponent('childCmp', {
|
|
|
|
template: '<div>inner { <div ng-outlet></div> }</div>',
|
|
|
|
$routeConfig: [
|
|
|
|
{ path: '/b', component: 'oneCmp' }
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
2016-01-27 15:05:34 -05:00
|
|
|
{ path: '/...', component: 'childCmp' }
|
|
|
|
]);
|
|
|
|
compile('<div>outer { <div ng-outlet></div> }</div>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/b');
|
2016-01-27 15:05:34 -05:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect(elt.text()).toBe('outer { inner { one } }');
|
|
|
|
expect($location.path()).toBe('/b');
|
|
|
|
}));
|
|
|
|
|
2015-08-20 17:26:57 -04:00
|
|
|
|
refactor(router): improve recognition and generation pipeline
This is a big change. @matsko also deserves much of the credit for the implementation.
Previously, `ComponentInstruction`s held all the state for async components.
Now, we introduce several subclasses for `Instruction` to describe each type of navigation.
BREAKING CHANGE:
Redirects now use the Link DSL syntax. Before:
```
@RouteConfig([
{ path: '/foo', redirectTo: '/bar' },
{ path: '/bar', component: BarCmp }
])
```
After:
```
@RouteConfig([
{ path: '/foo', redirectTo: ['Bar'] },
{ path: '/bar', component: BarCmp, name: 'Bar' }
])
```
BREAKING CHANGE:
This also introduces `useAsDefault` in the RouteConfig, which makes cases like lazy-loading
and encapsulating large routes with sub-routes easier.
Previously, you could use `redirectTo` like this to expand a URL like `/tab` to `/tab/posts`:
@RouteConfig([
{ path: '/tab', redirectTo: '/tab/users' }
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
Now the recommended way to handle this is case is to use `useAsDefault` like so:
```
@RouteConfig([
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
@RouteConfig([
{ path: '/posts', component: PostsCmp, useAsDefault: true, name: 'Posts' },
{ path: '/users', component: UsersCmp, name: 'Users' }
])
TabsCmp { ... }
```
In the above example, you can write just `['/Tab']` and the route `Users` is automatically selected as a child route.
Closes #4728
Closes #4228
Closes #4170
Closes #4490
Closes #4694
Closes #5200
Closes #5475
2015-11-23 21:07:37 -05:00
|
|
|
it('should work with recursive nested outlets', function () {
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('recurCmp', {
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
template: '<div>recur { <div ng-outlet></div> }</div>',
|
|
|
|
$routeConfig: [
|
|
|
|
{ path: '/recur', component: 'recurCmp' },
|
|
|
|
{ path: '/end', component: 'oneCmp' }
|
|
|
|
]});
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/recur', component: 'recurCmp' },
|
|
|
|
{ path: '/', component: 'oneCmp' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
compile('<div>root { <div ng-outlet></div> }</div>');
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/recur/recur/end');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
expect(elt.text()).toBe('root { one }');
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should change location path', inject(function ($location) {
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/user', component: 'userCmp' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
compile('<div ng-outlet></div>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/user');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect($location.path()).toBe('/user');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-02-07 17:09:06 -05:00
|
|
|
it('should pass through query terms to the location', inject(function ($location) {
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
2016-02-07 17:09:06 -05:00
|
|
|
{ path: '/user', component: 'userCmp' }
|
|
|
|
]);
|
|
|
|
|
|
|
|
compile('<div ng-outlet></div>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/user?x=y');
|
2016-02-07 17:09:06 -05:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect($location.path()).toBe('/user');
|
|
|
|
expect($location.search()).toEqual({ x: 'y'});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-08-20 17:26:57 -04:00
|
|
|
it('should change location to the canonical route', inject(function ($location) {
|
|
|
|
compile('<div ng-outlet></div>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(router): improve recognition and generation pipeline
This is a big change. @matsko also deserves much of the credit for the implementation.
Previously, `ComponentInstruction`s held all the state for async components.
Now, we introduce several subclasses for `Instruction` to describe each type of navigation.
BREAKING CHANGE:
Redirects now use the Link DSL syntax. Before:
```
@RouteConfig([
{ path: '/foo', redirectTo: '/bar' },
{ path: '/bar', component: BarCmp }
])
```
After:
```
@RouteConfig([
{ path: '/foo', redirectTo: ['Bar'] },
{ path: '/bar', component: BarCmp, name: 'Bar' }
])
```
BREAKING CHANGE:
This also introduces `useAsDefault` in the RouteConfig, which makes cases like lazy-loading
and encapsulating large routes with sub-routes easier.
Previously, you could use `redirectTo` like this to expand a URL like `/tab` to `/tab/posts`:
@RouteConfig([
{ path: '/tab', redirectTo: '/tab/users' }
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
Now the recommended way to handle this is case is to use `useAsDefault` like so:
```
@RouteConfig([
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
@RouteConfig([
{ path: '/posts', component: PostsCmp, useAsDefault: true, name: 'Posts' },
{ path: '/users', component: UsersCmp, name: 'Users' }
])
TabsCmp { ... }
```
In the above example, you can write just `['/Tab']` and the route `Users` is automatically selected as a child route.
Closes #4728
Closes #4228
Closes #4170
Closes #4490
Closes #4694
Closes #5200
Closes #5475
2015-11-23 21:07:37 -05:00
|
|
|
{ path: '/', redirectTo: ['/User'] },
|
|
|
|
{ path: '/user', component: 'userCmp', name: 'User' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect($location.path()).toBe('/user');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should change location to the canonical route with nested components', inject(function ($location) {
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('childRouter', {
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
template: '<div>inner { <div ng-outlet></div> }</div>',
|
|
|
|
$routeConfig: [
|
refactor(router): improve recognition and generation pipeline
This is a big change. @matsko also deserves much of the credit for the implementation.
Previously, `ComponentInstruction`s held all the state for async components.
Now, we introduce several subclasses for `Instruction` to describe each type of navigation.
BREAKING CHANGE:
Redirects now use the Link DSL syntax. Before:
```
@RouteConfig([
{ path: '/foo', redirectTo: '/bar' },
{ path: '/bar', component: BarCmp }
])
```
After:
```
@RouteConfig([
{ path: '/foo', redirectTo: ['Bar'] },
{ path: '/bar', component: BarCmp, name: 'Bar' }
])
```
BREAKING CHANGE:
This also introduces `useAsDefault` in the RouteConfig, which makes cases like lazy-loading
and encapsulating large routes with sub-routes easier.
Previously, you could use `redirectTo` like this to expand a URL like `/tab` to `/tab/posts`:
@RouteConfig([
{ path: '/tab', redirectTo: '/tab/users' }
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
Now the recommended way to handle this is case is to use `useAsDefault` like so:
```
@RouteConfig([
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
@RouteConfig([
{ path: '/posts', component: PostsCmp, useAsDefault: true, name: 'Posts' },
{ path: '/users', component: UsersCmp, name: 'Users' }
])
TabsCmp { ... }
```
In the above example, you can write just `['/Tab']` and the route `Users` is automatically selected as a child route.
Closes #4728
Closes #4228
Closes #4170
Closes #4490
Closes #4694
Closes #5200
Closes #5475
2015-11-23 21:07:37 -05:00
|
|
|
{ path: '/new-child', component: 'oneCmp', name: 'NewChild'},
|
|
|
|
{ path: '/new-child-two', component: 'twoCmp', name: 'NewChildTwo'}
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
]
|
|
|
|
});
|
2015-08-20 17:26:57 -04:00
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(router): improve recognition and generation pipeline
This is a big change. @matsko also deserves much of the credit for the implementation.
Previously, `ComponentInstruction`s held all the state for async components.
Now, we introduce several subclasses for `Instruction` to describe each type of navigation.
BREAKING CHANGE:
Redirects now use the Link DSL syntax. Before:
```
@RouteConfig([
{ path: '/foo', redirectTo: '/bar' },
{ path: '/bar', component: BarCmp }
])
```
After:
```
@RouteConfig([
{ path: '/foo', redirectTo: ['Bar'] },
{ path: '/bar', component: BarCmp, name: 'Bar' }
])
```
BREAKING CHANGE:
This also introduces `useAsDefault` in the RouteConfig, which makes cases like lazy-loading
and encapsulating large routes with sub-routes easier.
Previously, you could use `redirectTo` like this to expand a URL like `/tab` to `/tab/posts`:
@RouteConfig([
{ path: '/tab', redirectTo: '/tab/users' }
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
Now the recommended way to handle this is case is to use `useAsDefault` like so:
```
@RouteConfig([
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
@RouteConfig([
{ path: '/posts', component: PostsCmp, useAsDefault: true, name: 'Posts' },
{ path: '/users', component: UsersCmp, name: 'Users' }
])
TabsCmp { ... }
```
In the above example, you can write just `['/Tab']` and the route `Users` is automatically selected as a child route.
Closes #4728
Closes #4228
Closes #4170
Closes #4490
Closes #4694
Closes #5200
Closes #5475
2015-11-23 21:07:37 -05:00
|
|
|
{ path: '/old-parent/old-child', redirectTo: ['/NewParent', 'NewChild'] },
|
|
|
|
{ path: '/old-parent/old-child-two', redirectTo: ['/NewParent', 'NewChildTwo'] },
|
|
|
|
{ path: '/new-parent/...', component: 'childRouter', name: 'NewParent' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
compile('<div ng-outlet></div>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/old-parent/old-child');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect($location.path()).toBe('/new-parent/new-child');
|
|
|
|
expect(elt.text()).toBe('inner { one }');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/old-parent/old-child-two');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect($location.path()).toBe('/new-parent/new-child-two');
|
|
|
|
expect(elt.text()).toBe('inner { two }');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should navigate when the location path changes', inject(function ($location) {
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/one', component: 'oneCmp' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
compile('<div ng-outlet></div>');
|
|
|
|
|
|
|
|
$location.path('/one');
|
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect(elt.text()).toBe('one');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-02-07 17:09:06 -05:00
|
|
|
it('should navigate when the location query changes', inject(function ($location) {
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
2016-02-07 17:09:06 -05:00
|
|
|
{ path: '/get/params', component: 'getParams' }
|
|
|
|
]);
|
|
|
|
compile('<div ng-outlet></div>');
|
|
|
|
|
|
|
|
$location.url('/get/params?x=y');
|
|
|
|
$rootScope.$digest();
|
|
|
|
|
|
|
|
expect(elt.text()).toBe('y');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
it('should expose a "navigating" property on $rootRouter', inject(function ($q) {
|
2015-08-20 17:26:57 -04:00
|
|
|
var defer;
|
2016-01-31 10:35:23 -05:00
|
|
|
registerDirective('pendingActivate', {
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
$canActivate: function () {
|
2015-08-20 17:26:57 -04:00
|
|
|
defer = $q.defer();
|
|
|
|
return defer.promise;
|
|
|
|
}
|
|
|
|
});
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.config([
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
{ path: '/pending-activate', component: 'pendingActivate' }
|
2015-08-20 17:26:57 -04:00
|
|
|
]);
|
|
|
|
compile('<div ng-outlet></div>');
|
|
|
|
|
2016-02-17 02:47:49 -05:00
|
|
|
$rootRouter.navigateByUrl('/pending-activate');
|
2015-08-20 17:26:57 -04:00
|
|
|
$rootScope.$digest();
|
2016-02-17 02:47:49 -05:00
|
|
|
expect($rootRouter.navigating).toBe(true);
|
2015-08-20 17:26:57 -04:00
|
|
|
defer.resolve();
|
|
|
|
$rootScope.$digest();
|
2016-02-17 02:47:49 -05:00
|
|
|
expect($rootRouter.navigating).toBe(false);
|
2015-08-20 17:26:57 -04:00
|
|
|
}));
|
|
|
|
|
2016-01-31 10:35:23 -05:00
|
|
|
function registerDirective(name, options) {
|
2016-02-25 08:09:31 -05:00
|
|
|
var controller = getController(options);
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
function factory() {
|
|
|
|
return {
|
|
|
|
template: options.template || '',
|
|
|
|
controllerAs: name,
|
2016-02-25 08:09:31 -05:00
|
|
|
controller: controller
|
refactor(angular_1_router): use directives for route targets
BREAKING CHANGE:
Previously, route configuration took a controller constructor function as the value of
`component` in a route definition:
```
$route.config([
{ route: '/', component: MyController }
])
```
Based on the name of the controller, we used to use a componentMapper service to
determine what template to pair with each controller, how to bind the instance to
the $scope.
To make the 1.x router more semantically alligned with Angular 2, we now route to a directive.
Thus a route configuration takes a normalized directive name:
```
$route.config([
{ route: '/', component: 'myDirective' }
])
```
BREAKING CHANGE:
In order to avoid name collisions, lifecycle hooks are now prefixed with `$`. Before:
```
MyController.prototype.onActivate = ...
```
After:
```
MyController.prototype.$onActivate = ...
```
Same for `$canActivate` (which now lives on the directive factory function),
`$canDeactivate`, `$canReuse`, and `$onDeactivate` hooks.
2015-09-18 18:53:50 -04:00
|
|
|
};
|
2015-08-20 17:26:57 -04:00
|
|
|
}
|
2016-02-25 08:09:31 -05:00
|
|
|
applyStaticProperties(controller, options);
|
2016-01-31 10:35:23 -05:00
|
|
|
$compileProvider.directive(name, factory);
|
|
|
|
}
|
2015-08-20 17:26:57 -04:00
|
|
|
|
2016-01-31 10:35:23 -05:00
|
|
|
function registerComponent(name, options) {
|
2015-08-20 17:26:57 -04:00
|
|
|
|
2016-01-31 10:35:23 -05:00
|
|
|
var definition = {
|
|
|
|
template: options.template || '',
|
|
|
|
controller: getController(options),
|
|
|
|
}
|
2016-02-25 08:09:31 -05:00
|
|
|
applyStaticProperties(definition.controller, options);
|
2016-01-31 10:35:23 -05:00
|
|
|
$compileProvider.component(name, definition);
|
2015-08-20 17:26:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function compile(template) {
|
|
|
|
elt = $compile('<div>' + template + '</div>')($rootScope);
|
|
|
|
$rootScope.$digest();
|
|
|
|
return elt;
|
|
|
|
}
|
2016-01-31 10:35:23 -05:00
|
|
|
|
|
|
|
function getController(options) {
|
|
|
|
var controller = options.controller || function () {};
|
|
|
|
[
|
|
|
|
'$routerOnActivate', '$routerOnDeactivate',
|
|
|
|
'$routerOnReuse', '$routerCanReuse',
|
|
|
|
'$routerCanDeactivate'
|
|
|
|
].forEach(function (hookName) {
|
|
|
|
if (options[hookName]) {
|
|
|
|
controller.prototype[hookName] = options[hookName];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return controller;
|
|
|
|
}
|
|
|
|
|
|
|
|
function applyStaticProperties(target, options) {
|
|
|
|
['$canActivate', '$routeConfig'].forEach(function(property) {
|
|
|
|
if (options[property]) {
|
|
|
|
target[property] = options[property];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2015-08-20 17:26:57 -04:00
|
|
|
});
|
2016-01-31 10:35:23 -05:00
|
|
|
|