Angular RelativeLinkResolution - 旧版和修正版之间的差异
Angular RelativeLinkResolution - Differences between legacy and corrected
我在阅读 angular 文档时发现了这个选项:
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'.
发件人:https://angular.io/api/router/ExtraOptions#relativeLinkResolution
但我的问题是 legacy 和 corrected 之间有什么区别? legacy 选项有什么用,使用 ../ 代替 ./ 有什么用?
正如Markus Pscheidt所说:
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.
我在阅读 angular 文档时发现了这个选项:
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'.
发件人:https://angular.io/api/router/ExtraOptions#relativeLinkResolution
但我的问题是 legacy 和 corrected 之间有什么区别? legacy 选项有什么用,使用 ../ 代替 ./ 有什么用?
正如Markus Pscheidt所说:
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.