Title: DI - Handle the "InjectFlags" in Injector_.get() · Issue #31776 · angular/angular · GitHub
Open Graph Title: DI - Handle the "InjectFlags" in Injector_.get() · Issue #31776 · angular/angular
X Title: DI - Handle the "InjectFlags" in Injector_.get() · Issue #31776 · angular/angular
Description: 🚀 feature request Relevant Package This feature request is for @angular/core Description At the moment the Injector_.get() implementation doesn't handle the InjectFlags. I'd like the feature so that I can use the component Injector like ...
Open Graph Description: 🚀 feature request Relevant Package This feature request is for @angular/core Description At the moment the Injector_.get() implementation doesn't handle the InjectFlags. I'd like the feature so tha...
X Description: 🚀 feature request Relevant Package This feature request is for @angular/core Description At the moment the Injector_.get() implementation doesn't handle the InjectFlags. I'd like the featur...
Opengraph URL: https://github.com/angular/angular/issues/31776
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DI - Handle the \"InjectFlags\" in Injector_.get()","articleBody":"\u003c!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅\r\n\r\nOh hi there! 😄 \r\n\r\nTo expedite issue processing please search open and closed issues before submitting a new one.\r\nExisting issues often contain information about workarounds, resolution, or progress updates.\r\n\r\n🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->\r\n\r\n\r\n# 🚀 feature request\r\n\r\n### Relevant Package\r\n\u003c!-- Can you pin-point one or more @angular/* packages the are relevant for this feature request? -->\r\n\u003c!-- ✍️edit: --> This feature request is for @angular/core\r\n\r\n\r\n### Description\r\nAt the moment the `Injector_.get()` implementation doesn't handle the `InjectFlags`. \r\n I'd like the feature so that I can use the component `Injector` like this:\r\n```typescript\r\n@Component(...)\r\nexport class SomeComponent {\r\n // Here I get an instance of Injector_\r\n constructor(injector: Injector) {\r\n this.myService = injector.get(SomeService, null, InjectFlags.SkipSelf);\r\n }\r\n}\r\n```\r\n\r\n\r\n\r\n### Describe the solution you'd like\r\nIt looks like you already handle the `DeepFlags`. [refs.ts:342](https://github.com/angular/angular/blob/da2880d7c495022405102f89b8c641b23516388d/packages/core/src/view/refs.ts#L342) \r\nYou probably just need to map and pass the `InjectFlags` to the `resolveDeep()` function\r\n```typescript\r\nclass Injector_ implements Injector {\r\n ...\r\n get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND): any {\r\n ...\r\n return Services.resolveDep(\r\n this.view, this.elDef, allowPrivateServices,\r\n {flags: DepFlags.None, token, tokenKey: tokenKey(token)}, notFoundValue);\r\n }\r\n}\r\n```\r\nI don't think I have enough knowledge of the project to submit a PR by myself, so I'm relying on you for this. \r\nThanks in advance for your work\r\n","author":{"url":"https://github.com/TomMenga","@type":"Person","name":"TomMenga"},"datePublished":"2019-07-22T09:26:49Z","url":"https://github.com/angular/angular/issues/31776"}
| 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:c4bb91bf-fc12-4d14-e11a-fbe7e437a2bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8D2:4E3C:12AAC87:18BCEBD:6B011BCC |
| html-safe-nonce | dc2eba34b68f9f45e287092c0dc365d01e1a946252cb855e05c384c6ab2365c5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEQyOjRFM0M6MTJBQUM4NzoxOEJDRUJEOjZCMDExQkNDIiwidmlzaXRvcl9pZCI6IjE0NDA3ODIzMzQ5Nzc3MTEwNTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 65a2073d5e1361aac3848a83a6b4d95d59a093a62892ea1a0f1482b73a283523 |
| hovercard-subject-tag | issue:470988455 |
| 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/31776/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9871bfedcb4cf372023f88c01f62e89af8fd57a170b04b40f4cfc26fe3917262/angular/angular/issues/31776 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9871bfedcb4cf372023f88c01f62e89af8fd57a170b04b40f4cfc26fe3917262/angular/angular/issues/31776 |
| og:image:alt | 🚀 feature request Relevant Package This feature request is for @angular/core Description At the moment the Injector_.get() implementation doesn't handle the InjectFlags. I'd like the feature so tha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TomMenga |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width