Title: Allow view creation during change detection · Issue #15634 · angular/angular · GitHub
Open Graph Title: Allow view creation during change detection · Issue #15634 · angular/angular
X Title: Allow view creation during change detection · Issue #15634 · angular/angular
Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting Current behavior Creating dynamically a new view from a lifecycle hook (ex.: ngOnInit) will result in the following err...
Open Graph Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting Current behavior Creating dynamically a new view from a lifecycle hook (ex.: ng...
X Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting Current behavior Creating dynamically a new view from a lifecy...
Opengraph URL: https://github.com/angular/angular/issues/15634
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow view creation during change detection","articleBody":"\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```\r\n\r\n**Current behavior**\r\n\r\nCreating dynamically a new view from a lifecycle hook (ex.: `ngOnInit`) will result in the following error:\r\n\r\n> ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'xxx'. Current value: 'yyy'. It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook ?\r\n\r\n**Expected behavior**\r\n\r\nDynamically created views should be change detected \"inline\" if possible (as right now), but if we cannot do this, we should change detect them at then end of the current run, and not throw the mentioned error.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\n\r\nhttps://plnkr.co/edit/uh4oxxA3Yq6i45SA52SS?p=preview\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\n\r\nThere are legitimate use-cases where a new view needs to be created from a lifecycle hook, ex.: opening a modal window from the `ngOnInit` lifecycle hook. This was initially reported on ng-bootstrap side via https://github.com/ng-bootstrap/ng-bootstrap/issues/1159\r\n\r\nThe pb was discussed with @tbosch and the issue is opened as the result of this discussion.\r\n\r\n* **Angular version:** \r\n\r\n2.3.x, 4.0.X\r\n\r\n* **Browser:** \r\n\r\nall\r\n \r\n* **Language:** \r\n\r\nall","author":{"url":"https://github.com/pkozlowski-opensource","@type":"Person","name":"pkozlowski-opensource"},"datePublished":"2017-03-30T18:54:05Z","url":"https://github.com/angular/angular/issues/15634"}
| 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:8c617369-45de-2084-a3ce-4f049927da94 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 940A:2270F4:1611927:1D52F1F:6B0137D5 |
| html-safe-nonce | 39dd981c1436ab882054dfed90a5354ce070af01abed2589f1bbc94ec7c4a3e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDBBOjIyNzBGNDoxNjExOTI3OjFENTJGMUY6NkIwMTM3RDUiLCJ2aXNpdG9yX2lkIjoiODU4OTIzNTE0MTE5MTIxOTE1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2a785a9e97bf09ef1e3a243681eb4f10562fce857caece9943d103aabe07ee4a |
| hovercard-subject-tag | issue:218293955 |
| 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/15634/issue_layout |
| twitter:image | https://opengraph.githubassets.com/21cbe630bd894c672e3c8d0c0ed199b60671703a3298a398e83604b8dabf7b8b/angular/angular/issues/15634 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/21cbe630bd894c672e3c8d0c0ed199b60671703a3298a398e83604b8dabf7b8b/angular/angular/issues/15634 |
| og:image:alt | I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting Current behavior Creating dynamically a new view from a lifecycle hook (ex.: ng... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pkozlowski-opensource |
| 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