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.

[routerLink]="null" should not affect the href attribute

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonadencommented, Nov 20, 2018

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.

0reactions
angular-automatic-lock-bot[bot]commented, Aug 10, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

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