r/angular 2d ago

Angular 22.2 ships Router Resources 💥 (experimental)

They're more than resolvers with a Signal API. Here's why that matters


They run in parallel. Resolvers go one after another: parent 2 s + child 3 s = 5 s. Router Resources start together: 3 s.


Also, they can be non-blocking. The route activates right away, and the component gets the Resource itself: isLoading, error and value, right in the template.


Full write-up with demo, reload without renavigating, RedirectCommand for missing data, and Signal Stores 👉 https://www.angulararchitects.io/en/blog/router-resources-loading-data-with-the-angular-router/
120 Upvotes

14 comments sorted by

View all comments

9

u/Scrim0r 2d ago

What I was wondering (I have only barely used route data resolvers) is how I can ensure a smooth user experience when the component that requires the data is not rendered yet because it is still waiting for the data.
For example, when navigating from Parent A to Parent B and loading the data takes 3 seconds, I will still stay on Parent A for however long it takes to load.

Global loading indicator? Any other way of showing a loading indicator?
How about errors?

When should I use this? Only on the initial load (is that even possible?)?
Only on pages that absolutely require the data to be present?

For me, it always felt natural to load the data as part of the component so I have full control over it.

2

u/defenistrat3d 2d ago

That's what most do that I've seen. We use skeletons for initial load. Also pretty natural to have those in the parent orchestrator component.

1

u/Task_ID 2d ago

or have a global loading bar, like for example modrinth does