CanLoad
CanLoad
Stable Interface
What it does
Interface that a class can implement to be a guard deciding if a children can be loaded.
How to use
class UserToken {} class Permissions { canLoadChildren(user: UserToken, id: string): boolean { return true; } } @Injectable() class CanLoadTeamSection implements CanLoad { constructor(private permissions: Permissions, private currentUser: UserToken) {} canLoad(route: Route( route: Route ): Observable<boolean>|Promise<boolean>|boolean { return this.permissions.canLoadChildren(this.currentUser, route); } } @NgModule({