Skip to content

feat: accept UrlTree in navigate and initialRoute - #603

Open
gabrielmethot wants to merge 1 commit into
testing-library:mainfrom
gabrielmethot:feat/navigate-url-tree
Open

gabrielmethot wants to merge 1 commit into
testing-library:mainfrom
gabrielmethot:feat/navigate-url-tree

Conversation

@gabrielmethot

Copy link
Copy Markdown

Hello,

This pull request adds new signatures to navigate and initialRoute to allow passing instances of UrlTree. This makes query params easier to configure because Angular handles the serialization. It also lets us pass a route fragment, which wasn't supported with string paths.

String paths work the same as before, but they behave differently from a UrlTree because they go through the library's own parser, which doesn't decode values or handle fragments. This can be surprising, so I documented it in the JSDoc.

It might be worth considering using Angular's parser as the default, because that's probably what most developers expect. The custom query params parser could then be deprecated. Since this would be a breaking change, it might fit better in a future major version. I'd love to hear your thoughts about this.

Thanks for taking the time to review this, and for your work on the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant