fix(router): recognize child components with empty segments
Previosly, recognition ended when a parent captured all the parsed URL segments. This caused routes that delegated from a parent to a child with an empty segment to never be recognized. Closes #4178
This commit is contained in:
@@ -115,6 +115,18 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should navigate to child routes that capture an empty path',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
compile('outer { <router-outlet></router-outlet> }')
|
||||
.then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
|
||||
.then((_) => rtr.navigateByUrl('/a'))
|
||||
.then((_) => {
|
||||
rootTC.detectChanges();
|
||||
expect(rootTC.debugElement.nativeElement).toHaveText('outer { inner { hello } }');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
it('should navigate to child routes of async routes', inject([AsyncTestCompleter], (async) => {
|
||||
compile('outer { <router-outlet></router-outlet> }')
|
||||
@@ -309,7 +321,8 @@ function parentLoader() {
|
||||
|
||||
@Component({selector: 'parent-cmp'})
|
||||
@View({template: "inner { <router-outlet></router-outlet> }", directives: [RouterOutlet]})
|
||||
@RouteConfig([new Route({path: '/b', component: HelloCmp})])
|
||||
@RouteConfig(
|
||||
[new Route({path: '/b', component: HelloCmp}), new Route({path: '/', component: HelloCmp})])
|
||||
class ParentCmp {
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user