Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular RelativeLinkResolution - Differences between legacy and corrected

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 ./ ?

like image 505
Napo Avatar asked Nov 16 '22 01:11

Napo


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.

like image 129
Napo Avatar answered Jun 13 '23 18:06

Napo