Title: Run multiple resolvers concurrently in router. · Issue #14279 · angular/angular · GitHub
Open Graph Title: Run multiple resolvers concurrently in router. · Issue #14279 · angular/angular
X Title: Run multiple resolvers concurrently in router. · Issue #14279 · angular/angular
Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not submit support request here, instead see https://github.com/an...
Open Graph Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not submit support request...
X Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not su...
Opengraph URL: https://github.com/angular/angular/issues/14279
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Run multiple resolvers concurrently in router.","articleBody":"**I'm submitting a ...** (check one with \"x\")\n```\n[ ] bug report => search github for a similar issue or PR before submitting\n[x] feature request\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\n```\n\n**Current behavior**\nI set multiple resolvers in my route:\n```typescript\nexport const routes: Routes = [\n {\n path: '',\n children: appRoutes,\n canActivate: [AuthGuard],\n resolve: {\n capabilities: CapabilitiesResolver,\n userInfo: OrganizationUserResolver,\n organizations: OrganizationResolver\n }\n }\n]\n```\neach of them implements Resolve interface and return Observable:\n```typescript\n@Injectable()\nexport class CapabilitiesResolver implements Resolve\u003cEndpoint[]> {\n constructor(private capabilitiesService: CapabilitiesService) {}\n\n resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable\u003cEndpoint[]> {\n return this.capabilitiesService.fetch()\n }\n}\n```\nas result all http requests run sequentially and this is not useful behavior for UX. But if resolvers return Promise instead of Observable:\n```typescript\nresolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise\u003cEndpoint[]> {\n return this.capabilitiesService.fetch().toPromise()\n }\n```\nthen all requests will be ran concurrently, very implicit behavior...\n\n**Expected behavior**\nNo matter what `resolve()` method return (Observable or Promise) all async operations should be ran concurrently.\n\n**What is the motivation / use case for changing the behavior?**\nFor users: Improve UX when router pre-fetch data.\nFor developers: More explicit router API.\n\n**Please tell us about your environment:**\n@angular/cli: 1.0.0-beta.30\nnode: 6.2.2\nos: darwin x64\n@angular/common: 2.4.1\n@angular/compiler: 2.4.1\n@angular/core: 2.4.1\n@angular/forms: 2.4.1\n@angular/http: 2.4.1\n@angular/platform-browser: 2.4.1\n@angular/platform-browser-dynamic: 2.4.1\n@angular/router: 3.4.1\n@angular/compiler-cli: 2.4.1\n\n* **Angular version:** 2.4.1\n\n* **Browser:** all\n\n \n* **Language:** TypeScript 2.0.3","author":{"url":"https://github.com/Iverson","@type":"Person","name":"Iverson"},"datePublished":"2017-02-03T11:57:11Z","url":"https://github.com/angular/angular/issues/14279"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2848cebf-7667-f4b9-d9c0-4dea60b2032f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE64:BBAAA:E501E6:12EE686:6B00FE88 |
| html-safe-nonce | 61a3ecec111204fc0b328c8e790433c96777b4b6ee8e299bf471f2ba82bb2709 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTY0OkJCQUFBOkU1MDFFNjoxMkVFNjg2OjZCMDBGRTg4IiwidmlzaXRvcl9pZCI6IjQ1MTY2NDY1NzU4NzQ4MzQwNTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9d8229d1330929d7324c9cb8877b243ef7a8a816ff078915b98717d012fbd25b |
| hovercard-subject-tag | issue:205139370 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/14279/issue_layout |
| twitter:image | https://opengraph.githubassets.com/66f7f417ffc00dc688b9238eb38e7c64bb30783da7a640daccc98854fb09483b/angular/angular/issues/14279 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/66f7f417ffc00dc688b9238eb38e7c64bb30783da7a640daccc98854fb09483b/angular/angular/issues/14279 |
| og:image:alt | I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not submit support request... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Iverson |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width