We have a few router guards that protect different parts of our app.
In some cases, but not in all, we want to do things when the guard returns false.
router.events.subscribe(event => {
if (event instanceof GuardsCheckEnd){
if (!event.shouldActivate){
//do stuff
}
}
});
The above code checks if any guard failed. We want to //do stuff
only when a specific guard failed.
Is there a way to find out which guard failed?
From what I understand you want to know which guards fail, so you should record their value in guard service. This way it will be available to you at all times.
First guard
Where this interests you