CanActivateOr interface
See original GitHub issueπ feature request
Relevant Package
This feature request is for @angular/routerDescription
The current implementation of CanActivate interface is:
If all guards return true, navigation will continue.
Describe the solution youβd like
It would be useful to exist a CanActivateOr interface that will evaluate the following:
If some guards return true, navigation will continue.
Example
const routes: Routes = [
{
path: 'pathA',
component: ComponentA,
resolve: {
data: ResolverA
},
CanActivateOr: [Guard1, Guard2] // If Guard1 OR Guard2 returns true then continue
}
];
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
CanActivate - Angular
Interface that a class can implement to be a guard deciding if a route can be activated. If all guards return true ,...
Read more >Angular CanActivate Guard Example - TekTutorialsHub
How to use CanActivate Guard ... First, we need to create a Angular Service. The service must import & implement the CanActivate Interface....
Read more >Angular Basics: CanActivateβIntroduction to Routing Guards
Angular route guards are interfaces provided by Angular which, when implemented, allow us to control the accessibility of a route based onΒ ...
Read more >Implementing Route Protection in Angular using CanActivate
This article will go through route protection in Angular and a step-by-step guide on implementing it using the CanActivate interface.
Read more >Understanding Angular Guards - codeburst
To implementing route guard preventing access to the specific route we use CanActivate interface. ... Now here we have two options, first is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

βandβ is what the framework already does, but I agree that Iβd KISS this and compose the guards instead.
It seems to me a better solution to write a new guard that composes your guards A and B, ORing their results, rather than lifting βorβ to the framework. Should the framework later do the same for βandβ?