Title: Update Styleguide Style 07-04 and mention `inject()` · Issue #54220 · angular/angular · GitHub
Open Graph Title: Update Styleguide Style 07-04 and mention `inject()` · Issue #54220 · angular/angular
X Title: Update Styleguide Style 07-04 and mention `inject()` · Issue #54220 · angular/angular
Description: Describe the problem that you experienced The Angular Styleguide recommends in Style 07-04, to use the @Injectable() class decorator instead of the @Inject param decorator. This recommendation seems to be partially outdated since it stil...
Open Graph Description: Describe the problem that you experienced The Angular Styleguide recommends in Style 07-04, to use the @Injectable() class decorator instead of the @Inject param decorator. This recommendation seem...
X Description: Describe the problem that you experienced The Angular Styleguide recommends in Style 07-04, to use the @Injectable() class decorator instead of the @Inject param decorator. This recommendation seem...
Opengraph URL: https://github.com/angular/angular/issues/54220
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Update Styleguide Style 07-04 and mention `inject()`","articleBody":"### Describe the problem that you experienced\n\nThe Angular Styleguide recommends in **Style 07-04**, to use the `@Injectable()` class decorator instead of the `@Inject` param decorator. This recommendation seems to be partially outdated since it still shows the constructor injection way of DI.\r\nIn my opinion more and more people are switching to use `inject()` since it has some advantages compared to the other approaches:\r\n\r\n- It's more universal and can be used in other [Injection Contexts](https://angular.dev/errors/NG0203#) as well and not only within the constructor\r\n- When looking at a whole application, a mix of constructor injections and injections via `inject()` (e. g. in functional interceptors or resolvers) causes confusion and makes the overall codebase harder to understand. It's simply more consistent\r\n- it doesn't collide with the native JS implementation for classes (keyword: `useDefineForClassFields`).\n\n### Enter the URL of the topic with the problem\n\nhttps://angular.dev/style-guide#style-07-04\n\n### Describe what you were looking for in the documentation\n\nhttps://angular.dev/errors/NG0203#\n\n### Describe the actions that led you to experience the problem\n\n_No response_\n\n### Describe what you want to experience that would fix the problem\n\n_No response_\n\n### Add a screenshot if that helps illustrate the problem\n\n_No response_\n\n### If this problem caused an exception or error, please paste it here\n\n_No response_\n\n### If the problem is browser-specific, please specify the device, OS, browser, and version\n\n_No response_\n\n### Provide any additional information here in as much as detail as you can\n\n_No response_","author":{"url":"https://github.com/d-koppenhagen","@type":"Person","name":"d-koppenhagen"},"datePublished":"2024-02-02T20:08:49Z","url":"https://github.com/angular/angular/issues/54220"}
| 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:b94000ba-101d-e13b-0ca3-54e13ff2ea00 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5BC:FC5BE:DDF022:1278295:6B010409 |
| html-safe-nonce | ea8f440f0f79c4f56955253771129d662501c96aefff2907c286122c717b8b3a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUJDOkZDNUJFOkRERjAyMjoxMjc4Mjk1OjZCMDEwNDA5IiwidmlzaXRvcl9pZCI6IjQ3NTc2NTQ4NzMyMzM3NTMwOTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f8773cb39a9101ffa827540b5061411f90103946fa659e896e1d599cfdf65c50 |
| hovercard-subject-tag | issue:2115700282 |
| 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/54220/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1d2db8daee4438517dd082826b373c4a32546872839ecb29792fed7792b0a579/angular/angular/issues/54220 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1d2db8daee4438517dd082826b373c4a32546872839ecb29792fed7792b0a579/angular/angular/issues/54220 |
| og:image:alt | Describe the problem that you experienced The Angular Styleguide recommends in Style 07-04, to use the @Injectable() class decorator instead of the @Inject param decorator. This recommendation seem... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | d-koppenhagen |
| 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