DEV Community

Cover image for Explore Angular Router's runGuardsAndResolvers

Explore Angular Router's runGuardsAndResolvers

Juri Strumpflohner on September 28, 2019

Learn how we can use new options introduced for the runGuardsAndResolvers setting for the Angular Router configuration to get a better control over...
Collapse
 
maxime1992 profile image
Maxime

That's cool for guards, but on the resolver part I don't understand why you'd ever use a resolver that's blocking the UI while it's fetching data. I know it's the whole point but from a user perspective having potentially huge lags whenever you go to a component using a resolver sounds like a bad experience 🤔
I've raised a stackoverflow question and no one could come up with a proper answer why you'd ever want to use them stackoverflow.com/q/49054232/2398593

Using ngrx for ex, you can do the same with effects in a non blocking way which is way nicer 😁.

Do you often user resolvers Juri? If so can you give some more context about how and why? Thanks

Collapse
 
juristr profile image
Juri Strumpflohner Angular

Hey Maxime. I totally agree. I've rarely used resolvers, especially not to block the transition, maybe just to kick of the loading which will then be picked up by the component.

I mostly just transition to the component which then takes care of loading the data, and in case show a ghost element in between or something. Everything else usually hurts the user experience as you said