-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Description
Which @angular/* package(s) are relevant/related to the feature request?
router
Description
I am used to using url trees in my route guards and also when navigating inside my Angular application in general.
Frequently I need the current router state as a UrlTree
. Current solution is to parse the current url string from state to a url tree as follows: this.router.parseUrl(state.url)
.
I recently noticed that the Router class actually has a private currentUrlTree
getter method:
private get currentUrlTree() {
return this.stateManager.getCurrentUrlTree();
}
Would it be possible to change this getter to public? Since the method is already there it should not really be a problem to make it publicly available right? Or would there be something against exposing the current url tree to the end users!?
If this feature request is eligible for merging I can make a pull-request.
Proposed solution
Make the getter Router.currentUrlTree
public.
Alternatives considered
Continue using other cumbersome solutions to get the current router state as a UrlTree
.