Title: ENVIRONMENT_INITIALIZER is eagerly loaded · Issue #45988 · angular/angular · GitHub
Open Graph Title: ENVIRONMENT_INITIALIZER is eagerly loaded · Issue #45988 · angular/angular
X Title: ENVIRONMENT_INITIALIZER is eagerly loaded · Issue #45988 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description When using the ENVIRONMENT_INITIALIZER token in a lazy loaded component, the expected behaviour is that it should run the provider only when...
Open Graph Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description When using the ENVIRONMENT_INITIALIZER token in a lazy loaded component, the expected behaviour is t...
X Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description When using the ENVIRONMENT_INITIALIZER token in a lazy loaded component, the expected behaviour is t...
Opengraph URL: https://github.com/angular/angular/issues/45988
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ENVIRONMENT_INITIALIZER is eagerly loaded","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncore\n\n### Is this a regression?\n\nNo\n\n### Description\n\nWhen using the ENVIRONMENT_INITIALIZER token in a lazy loaded component, the expected behaviour is that it should run the provider only when the path matches. \r\n\r\n```ts\r\n {\r\n path: 'posts',\r\n loadComponent: () => import('./posts.component').then(m => m.PostsComponent),\r\n children: [\r\n {\r\n path: ':id',\r\n loadComponent: () => import('./post.component').then(m => m.PostComponent),\r\n providers: [{\r\n provide: ENVIRONMENT_INITIALIZER,\r\n multi: true,\r\n useValue() {\r\n console.log('loaded')\r\n }\r\n }]\r\n }\r\n ]\r\n```\r\n\r\nWhy in this case, I see the log when navigate to `posts`. I should see it only when navigating to `posts/:id`.\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n_No response_\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\n14.0.0-next.16\n```\n\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/ArielGueta","@type":"Person","name":"ArielGueta"},"datePublished":"2022-05-13T14:14:22Z","url":"https://github.com/angular/angular/issues/45988"}
| 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:ebf5a211-1434-acc6-376a-17e965886f60 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA0C:2564D8:F850D1:148CC32:6B01070D |
| html-safe-nonce | 7de63b118aa8654d6d641b021b948c427bc44392ddbb27be6bdec2952cb95804 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTBDOjI1NjREODpGODUwRDE6MTQ4Q0MzMjo2QjAxMDcwRCIsInZpc2l0b3JfaWQiOiI0Mzk0ODA4MzI2NjAxMzc3NTQ5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f67764512c20462694fff7b2d9bd82cf836b57107e02d23e4eb374984667a315 |
| hovercard-subject-tag | issue:1235303747 |
| 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/45988/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2d21986d64767f28f892a78b1c982cc8aedb94bb7412fc65f661351ab3e01de4/angular/angular/issues/45988 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2d21986d64767f28f892a78b1c982cc8aedb94bb7412fc65f661351ab3e01de4/angular/angular/issues/45988 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description When using the ENVIRONMENT_INITIALIZER token in a lazy loaded component, the expected behaviour is t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ArielGueta |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width