Angular RelativeLinkResolution - Differences between legacy and corrected

Viewed 12437

I was reading the angular documentation and I came across this option:

From the ContainerComponent, you should be able to navigate to AComponent using the following routerLink, but it will not work if relativeLinkResolution is set to 'legacy':

<a [routerLink]="['./a']">Link to A</a>

However, this will work:

<a [routerLink]="['../a']">Link to A</a>

In other words, you're required to use ../ rather than ./ when the relative link resolution is set to 'legacy'.

From: https://angular.io/api/router/ExtraOptions#relativeLinkResolution

But my question is what is the difference between legacy and corrected? and what is the use of the legacy option, what use I can have by using ../ instead of ./ ?

1 Answers

As Markus Pscheidt said:

legacy (how it used to be) = two dots to refer to same level.

corrected (now default in Angular 11) = using a single dot to refer to same level.

Related