Cannot remove outlets from path
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
It seems impossible to navigate to some path and clear any named outlets in the process. Consider this code:
this.router.navigate(['/', { outlets: { secondary: null } });
This does not remove the (secondary:)
portion from the path. However this code does remove that segment:
this.router.navigate([{ outlets: { secondary: null } });
In addition this.router.navigateByUrl('/')
also works.
Expected behavior
The first code should also work and remove the secondary outlet segment from the path.
Minimal reproduction of the problem with instructions
http://plnkr.co/edit/hFsOdLLr2LCq8cJyOF6R?p=preview
What is the motivation / use case for changing the behavior?
The current behavior looks erroneous. I believe there should be an else
here which sets children[outlet]
to null
so it is not initialized later.
Please tell us about your environment:
- Angular version: 2.4.10
Code in master looks the same as in 2.4.10.
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
All browsers.
- Language: [all | TypeScript X.X | ES6/7 | ES5] I think it is a framework issue rather than a language one.
- Node (for AoT issues):
node --version
=
Issue Analytics
- State:
- Created 7 years ago
- Reactions:44
- Comments:30 (3 by maintainers)
It would be nice to use it with the
routerLink
directive as well.Thanks!
FWIW I am using the following as a workaround: