Title: Lifecycle hooks inheritance not working in production · Issue #15756 · angular/angular · GitHub
Open Graph Title: Lifecycle hooks inheritance not working in production · Issue #15756 · angular/angular
X Title: Lifecycle hooks inheritance not working in production · Issue #15756 · angular/angular
Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] 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") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request...
X Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not su...
Opengraph URL: https://github.com/angular/angular/issues/15756
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Lifecycle hooks inheritance not working in production","articleBody":"\u003c!--\r\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\r\n-->\r\n\r\n**I'm submitting a ...** (check one with \"x\")\r\n```\r\n[x] bug report => search github for a similar issue or PR before submitting\r\n[ ] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nIf some component extends a class that implements lifecycle hooks, then methods of super class (ngOnInit, ngAfterViewInit etc) are not being called. Event though they exist on component instance.\r\n\r\n**Expected behavior**\r\nInherited lifecycles hooks should be called.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\nThis issue happens only when building in production mode (I'm using for that @angular/cli 4.0.1).\r\n```\r\nimport { Component, OnInit } from '@angular/core';\r\n\r\nclass Foo implements OnInit {\r\n ngOnInit() {\r\n alert('Foo initialized');\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'app-root',\r\n template: 'App works',\r\n})\r\nexport class AppComponent extends Foo {}\r\n```\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nNow to fix this, one has to add manually ngOnInit on the component:\r\n```\r\n@Component({\r\n selector: 'app-root',\r\n template: 'App works',\r\n})\r\nexport class AppComponent extends Foo {\r\n ngOnInit() {\r\n super.ngOnInit();\r\n }\r\n}\r\n```\r\n\r\n**Please tell us about your environment:**\r\nWindows 10, Sublime text, angular-cli\r\n\u003c!-- Operating system, IDE, package manager, HTTP server, ... -->\r\n\r\n* **Angular version:** 4.0.1\r\n\u003c!-- Check whether this is still an issue in the most recent Angular version -->\r\n\r\n* **Browser:** Chrome\r\n \r\n* **Language:** Typescript 2.2.2\r\n\r\n* **Node (for AoT issues):** `node --version` = 7.8.0\r\n","author":{"url":"https://github.com/dmitrysteblyuk","@type":"Person","name":"dmitrysteblyuk"},"datePublished":"2017-04-04T12:41:09Z","url":"https://github.com/angular/angular/issues/15756"}
| 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:33a72b02-7ef7-59ff-7e29-2beb7969a3e2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA4E:3DD488:9B6F48:C69285:6B00F142 |
| html-safe-nonce | 5d8ddb5e702dae8215887fde68217b6fb0cfb1a930574793138ddb7d3e3d0caf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTRFOjNERDQ4ODo5QjZGNDg6QzY5Mjg1OjZCMDBGMTQyIiwidmlzaXRvcl9pZCI6IjQyNjU3MDIzODcwNzI2OTI1NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7d61bdd3b604cfad568f25a2ffa8bfd467262bd41674c7069a1b1fd41045560d |
| hovercard-subject-tag | issue:219237190 |
| 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/15756/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2a515a49828443ca16f41b9b69aeed01c3d4ebaf357b868fe0c8063d1d7b0e11/angular/angular/issues/15756 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2a515a49828443ca16f41b9b69aeed01c3d4ebaf357b868fe0c8063d1d7b0e11/angular/angular/issues/15756 |
| og:image:alt | I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] 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 | dmitrysteblyuk |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width