fix(router): make relativeLinkResolution corrected by default (#25609)

We are changing the default value from 'legacy' to 'corrected' so that new
applications are automatically opted-in to the corrected behavior from #22394.

BREAKING CHANGE: This commit changes the default value of
`relativeLinkResolution` from `'legacy'` to `'default'`. If your
application previously used the default by not specifying a value in the
`ExtraOptions` and uses relative links when navigating from children of
empty path routes, you will need to update your `RouterModule` to
specifically specify `'legacy'` for `relativeLinkResolution`.
See https://angular.io/api/router/ExtraOptions#relativeLinkResolution
for more details.

PR Close #25609
This commit is contained in:
Dirk Luijk 2018-08-22 14:41:26 +02:00 committed by Alex Rickabaugh
parent bd7d8744fa
commit 837889f0a4
2 changed files with 4 additions and 3 deletions

View File

@ -443,7 +443,7 @@ export class Router {
* Enables a bug fix that corrects relative link resolution in components with empty paths. * Enables a bug fix that corrects relative link resolution in components with empty paths.
* @see `RouterModule` * @see `RouterModule`
*/ */
relativeLinkResolution: 'legacy'|'corrected' = 'legacy'; relativeLinkResolution: 'legacy'|'corrected' = 'corrected';
/** /**
* Creates the router service. * Creates the router service.

View File

@ -425,8 +425,9 @@ export interface ExtraOptions {
* *
* `<a [routerLink]="['../a']">Link to A</a>` * `<a [routerLink]="['../a']">Link to A</a>`
* *
* In other words, you're required to use `../` rather than `./`. This is currently the default * In other words, you're required to use `../` rather than `./`.
* behavior. Setting this option to `corrected` enables the fix. *
* The default in v11 is `corrected`.
*/ */
relativeLinkResolution?: 'legacy'|'corrected'; relativeLinkResolution?: 'legacy'|'corrected';
} }