feat(router): provide RouteConfig object for AuxRoute

Closes #4319
This commit is contained in:
Brian Ford
2015-10-30 17:05:30 -07:00
parent 23784a2eca
commit 0ebe283b37
5 changed files with 41 additions and 11 deletions
@@ -97,6 +97,20 @@ export function main() {
}));
it('should work in an app with aux routes', inject([AsyncTestCompleter], (async) => {
bootstrap(AuxAppCmp, testBindings)
.then((applicationRef) => {
var router = applicationRef.hostComponent.router;
router.subscribe((_) => {
expect(el).toHaveText('root { hello } aside { hello }');
expect(applicationRef.hostComponent.location.path()).toEqual('/hello(aside)');
async.done();
});
router.navigateByUrl('/hello(aside)');
});
}));
it('should work in an app with async components defined with "loader"',
inject([AsyncTestCompleter], (async) => {
bootstrap(ConciseAsyncAppCmp, testBindings)
@@ -227,6 +241,13 @@ class ConciseAsyncAppCmp {
constructor(public router: Router, public location: LocationStrategy) {}
}
@Component({selector: 'app-cmp'})
@View({template: `root { <router-outlet></router-outlet> } aside { <router-outlet name="aside"></router-outlet> }`, directives: ROUTER_DIRECTIVES})
@RouteConfig([{path: '/hello', component: HelloCmp}, {aux: 'aside', component: HelloCmp}])
class AuxAppCmp {
constructor(public router: Router, public location: LocationStrategy) {}
}
@Component({selector: 'app-cmp'})
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
@RouteConfig([