[routerLink]="null" should not affect the href attribute
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
the following template: <a href="my/custom/url" [routerLink]="null">link</a>
is generated to: <a href="current/page/url">link</a>
Expected behavior
the following template: <a href="my/custom/url" [routerLink]="null">link</a>
should be generated to: <a href="my/custom/url">link</a>
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/angular-gitter-63xra2?file=app%2Fapp.component.html
What is the motivation / use case for changing the behavior?
In case you have an array of links to handle, and the array includes links with ‘routerLink routes’ and ‘normal (pl absolute-) URLs’. Then it’s much easier to handle them in a template (see: reproduction example)
Environment
Angular version: 6.1.7
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How can I conditionally disable the routerLink attribute?
When linkEnabled returns false , null will make routerLink to link to the current/active route. If routerLink links to the active route, the...
Read more >RouterLink - Angular
Represents an href attribute value applied to a host element, when a host element is <a> . For other tags, the value is...
Read more >ASP.NET Core Blazor routing and navigation - Microsoft Learn
This article explains how to manage request routing and how to use the NavLink component to create navigation links in Blazor apps.
Read more >API Documentation | Vue Router
Defaults to location.pathname + location.search If there is a <base> tag in the head , its value will be ignored in favor of...
Read more >What's new in Angular v13! - Nx Blog
For HTML Anchor elements, it will also remove the href attribute. Before, the null and undefined inputs for the routerLink directive were ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the issue. This seems quite specific, so I set the frequency to
low
, but at the same time it’s definitely broken. I don’t think it’s a feature request, but actually a bug.I don’t know when this one can get scheduled. I’m putting on the
community-help
label to see if someone can help grab this and get it fixed.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.