MCPcopy Create free account
hub / github.com/angular/angular / MyCanActivateGuard

Class MyCanActivateGuard

packages/router/test/computed_state_restoration.spec.ts:58–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 }
57
58 @Injectable({providedIn: 'root'})
59 class MyCanActivateGuard {
60 allow: boolean = true;
61 redirectTo: string | null | UrlTree = null;
62
63 constructor(private router: Router) {}
64
65 canActivate(): boolean | UrlTree {
66 if (typeof this.redirectTo === 'string') {
67 this.router.navigateByUrl(this.redirectTo);
68 } else if (isUrlTree(this.redirectTo)) {
69 return this.redirectTo;
70 }
71 return this.allow;
72 }
73 }
74 @Injectable({providedIn: 'root'})
75 class MyResolve {
76 myresolve = of(2);

Callers

nothing calls this directly

Calls 1

InjectableInterface · 0.90

Tested by

no test coverage detected