question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(router-link): Accept UrlTree as input

See original GitHub issue

šŸš€ feat(router-link): Accept UrlTree as input

Relevant Package

This feature request is for @angular/router

Description

Currently [routerLink] directive accepts either an array of commands or a string. Since angular uses UrlTree as a model to store urls, it’d be great to extend this directive so that in addition it accepts a UrlTree.

Describe the solution you’d like

Let [routerLink] input accept commands: any[]|string|UrlTree.

Describe alternatives you’ve considered

  • A different directive for this purpose. But having already a directive for that it’d be great to just extend the API.
  • A pipe that converts a UrlTree into a string. The problem is that the params that a UrlTree might include should be extracted and put in their respective inputs. So that doesn’t play nicely with all the features UrlTree have.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:35
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
angular-robot[bot]commented, Jun 4, 2021

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular’s feature request process in our documentation.

0reactions
esoubiran-aneocommented, Nov 29, 2022

Is there any way to pass this ā€œ/route?query=stringā€ to routerLink without a serialization?

[routerLink]=ā€œ[ā€˜/route?query=string’]ā€ will return ā€œ/route%3Fquery%3Dstringā€

Not very convenient

Read more comments on GitHub >

github_iconTop Results From Across the Web

RouterLink - Angular
The input that you provide to the link is treated as a delta to the current URL. For instance, suppose the current URL...
Read more >
How to pass a parameter to routerLink that is somewhere ...
In your particular example you'd do the following routerLink : [routerLink]="['user', user.id, 'details']". To do so in a controller, you can inject RouterĀ ......
Read more >
In-app navigation: routing to views - Angular
To handle the navigation from one view to the next, you use the Angular router. The router enables navigation by interpreting a browser...
Read more >
@angular/router-deprecated | Yarn - Package Manager
CanLoad guards in the Router are deprecated. Use CanMatch instead. compiler-cli. Commit, Type, Description. 7d88700933, fix, accept inheriting the constructorĀ ...
Read more >
Strapi v4 Authentication and Authorization with Angular 13 on ...
isLoggedIn">Sign Up</button> <button routerLink="/auth/login" type="button" ... To make the TitleComponent inputs take undefined values,Ā ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found