feat(router): allow CanLoad guard to return UrlTree (#36610)
A CanLoad guard returning UrlTree cancels current navigation and redirects. This matches the behavior available to `CanActivate` guards added in #26521. Note that this does not affect preloading. A `CanLoad` guard blocks any preloading. That is, any route with a `CanLoad` guard is not preloaded and the guards are not executed as part of preloading. fixes #28306 PR Close #36610
This commit is contained in:

committed by
Andrew Kushnir

parent
cae2a893f2
commit
00e6cb1d62
2
goldens/public-api/router/router.d.ts
vendored
2
goldens/public-api/router/router.d.ts
vendored
@ -64,7 +64,7 @@ export declare interface CanDeactivate<T> {
|
||||
}
|
||||
|
||||
export declare interface CanLoad {
|
||||
canLoad(route: Route, segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean;
|
||||
canLoad(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
||||
}
|
||||
|
||||
export declare class ChildActivationEnd {
|
||||
|
Reference in New Issue
Block a user