'Angular route protection with AuthGuard use only one time

i am protecting all my routes with a single Authguard and right now i am using in each route

canActivate: [AuthguardService]

my application has 30+ routes and so i need to type this 30 times in each route. Is there a way to protect all my routes with only one entry of my authguard ?

Thanks



Solution 1:[1]

You could define all the routes as child of one protected route: https://codecraft.tv/courses/angular/routing/router-guards/

Are all the routes on the same module?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jcobo1