-
Notifications
You must be signed in to change notification settings - Fork 25.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run multiple resolvers concurrently in router. #14279
Comments
This looks interesting. I've currently got the problem whereby at a single route I need to wait for data from the result of one resolvers service call to complete before calling another service with the previous resolved data. How would I be able to do this with the above changes? |
We could have a chain of resolver dependency to solve this problem. May be the the following approach can be used.
Note : We can get the data loaded by Data1Resolver inside the resolve method of SubData1Resolver. So that synchronous resolver can be called and data can be shared. |
That looks good. Just to clarify - You'd get the choice of both, data1 & data2 resolve concurrently. And subdata1 values resolve sequentially after data1 values are resolved. Is this not available already? It sounds like it would be a solution to a very common problem, I haven't found anything on the Angular site. |
Is this feature available now in Angular 4? If I have multiple resolvers, would they run concurrently? |
Hi I would like to know the state of this issue since I do not want to run my resolvers concurrently. I would need them to be executed sequentially. @hibumbapartha is your code working? |
Actually i need the opposite: One guard (resolve or canActivate) should WAIT for the previous before it executes. I have to prevent concurrent execution. |
@MickL I need the same thing! |
I opened a issue here: #21702 Feel free to give it a thumbs up |
So to clarify, there's no in built way to resolve multiple one after each other, like how it used to work? 'cause if so this makes me weep a little! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a ... (check one with "x")
Current behavior
I set multiple resolvers in my route:
each of them implements Resolve interface and return Observable:
as result all http requests run sequentially and this is not useful behavior for UX. But if resolvers return Promise instead of Observable:
then all requests will be ran concurrently, very implicit behavior...
Expected behavior
No matter what
resolve()
method return (Observable or Promise) all async operations should be ran concurrently.What is the motivation / use case for changing the behavior?
For users: Improve UX when router pre-fetch data.
For developers: More explicit router API.
Please tell us about your environment:
@angular/cli: 1.0.0-beta.30
node: 6.2.2
os: darwin x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1
Angular version: 2.4.1
Browser: all
Language: TypeScript 2.0.3
The text was updated successfully, but these errors were encountered: