Skip to content

Breaking undocumented change from Angular 13 to 14 in custom PreloadingStrategy. "preload"-method is called despite a set canLoad-guard. #47003

@5te1n

Description

@5te1n

Which @angular/* package(s) are the source of the bug?

core, router

Is this a regression?

Yes

Description

In Angular 13.3.10 the "preload"-Method in a custom PreloadingStrategy is not called for routes with a set canLoad-guard.
https://stackblitz.com/edit/angular-ivy-wf131m?file=src/app/app-routing.module.ts
This is also mentioned in the documentation: https://angular.io/guide/router-tutorial-toh#canload-blocks-preload

In Angular 14.0.0 this behaviour changed. The "preload"-method is called despite a set canLoad-guard. This change was not mentioned in the changelog and is the opposite of what is written in the documentation. Is this an intended change?
https://stackblitz.com/edit/angular-ivy-nabdle?file=src/app/app-routing.module.ts

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-ivy-nabdle?file=src/app/app-routing.module.ts

Please provide the exception or error you saw

The "preload"-method is called despite a set canLoad-guard in angular 14.

Please provide the environment you discovered this bug in (run ng version)

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: router

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions