Angular 2 router guards can be defined in an array. for example:
<code>
canActivate: ['CanAlwaysActivateGuard','AuthGuard']
</code>
following are my questions:
what will be the order of execution for both the guards.
They will be run synchronously without waiting for each other.
if i want to execute AuthGuard only if CanAlwaysActivateGuard returns true, would that be possible.
No, it's not possible with current implementation. As a workaround you can create a wrapper guards to run your guards in order.
Also see this How to wait for guards in Angular.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With