Title: Dependency Injection not working for Components/Directives inherited from Angular2 Components/Directives. · Issue #8700 · angular/angular · GitHub
Open Graph Title: Dependency Injection not working for Components/Directives inherited from Angular2 Components/Directives. · Issue #8700 · angular/angular
X Title: Dependency Injection not working for Components/Directives inherited from Angular2 Components/Directives. · Issue #8700 · angular/angular
Description: Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub.
Open Graph Description: Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub.
X Description: Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub.
Opengraph URL: https://github.com/angular/angular
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dependency Injection not working for Components/Directives inherited from Angular2 Components/Directives.","articleBody":"Dependency Injection not working for Components/Directives inherited from Angular2 Components/Directives if using TypeScript Compiler instead of Angular Template Compiler.\n\n**Steps to reproduce and a minimal demo of the problem**\n1. Define DatePicker directive inherited from DefaultValueAccessor.\n2. Add any additional parameter to DatePicker constructor (e.g. `logger: Logger`).\n3. Compile source code with TypeScript Compiler.\n4. Run application.\n\n```\n@Injectable()\nclass Logger {}\n\n@Directive({\n selector: '[datePicker]'\n})\nclass DatePicker extends DefaultValueAccessor {\n constructor(renderer: Renderer, element: ElementRef, logger: Logger) {\n super(renderer, element);\n if (!logger) {\n console.error('Logger is undefined');\n } else {\n console.info('Logger is defined');\n }\n }\n}\n```\n\nMinimal demo: http://plnkr.co/edit/UIybCDlayhXRO7x0Y7Lk?p=preview\n\n**Current behavior**\nDatePicker resolved using ctorParameters from DefaultValueAccessor (renderer, element) instead of metadata from DatePicker constructor (renderer, element, logger).\n(see `ReflectionCapabilities.parameters(typeOrFunc: Type): any[][]` implementation for details)\n\n**Expected/desired behavior**\nDatePicker resolved using parameters from its constructor metadata (renderer, element, logger).\n\n**Other information**\nCurrent implementation of `ReflectionCapabilities.parameters(typeOrFunc: Type): any[][]` work properly only if code was compiled using Angular Template Compiler, otherwise it will never check metadata, because ctorParameters decorator data inherited from parent hides it.\n","author":{"url":"https://github.com/sergeykhomyuk","@type":"Person","name":"sergeykhomyuk"},"datePublished":"2016-05-17T18:09:47Z","url":"https://github.com/angular/angular/issues/8700"}
| 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 | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:c391234c-eb95-1e70-537b-801eaa881c8a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CCA:1AE20C:68C605:8677A9:6B00DFEF |
| html-safe-nonce | 6b3fd4e13f2a5fc0a9b0e4b564a9a21252784a7ddea81c40aa058dd651158758 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0NBOjFBRTIwQzo2OEM2MDU6ODY3N0E5OjZCMDBERkVGIiwidmlzaXRvcl9pZCI6IjU5NDQyMzY1Nzc3MDUyMjIxMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a5e16fdad134392942ab8653de84831af3808578364fd1058714fe86f64379d4 |
| hovercard-subject-tag | repository:24195339 |
| 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/angular/angular/issues/8700 |
| twitter:image | https://repository-images.githubusercontent.com/24195339/d4194dc2-d880-43f7-960c-ea30e05c6531 |
| twitter:card | summary_large_image |
| og:image | https://repository-images.githubusercontent.com/24195339/d4194dc2-d880-43f7-960c-ea30e05c6531 |
| og:image:alt | Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub. |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-cache |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width