Title: Content projected into an ng-template should not be initialized without creating an embedded view · Issue #18691 · angular/angular · GitHub
Open Graph Title: Content projected into an ng-template should not be initialized without creating an embedded view · Issue #18691 · angular/angular
X Title: Content projected into an ng-template should not be initialized without creating an embedded view · Issue #18691 · angular/angular
Description: In Angular Material, our tabs API looks like this:
Open Graph Description: In Angular Material, our tabs API looks like this:
X Description: In Angular Material, our tabs API looks like this: <md-tab-group> <md-tab label="Overview"> ... </md-tab> <md-tab label="API"> ... </md-tab> <md...
Opengraph URL: https://github.com/angular/angular/issues/18691
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Content projected into an ng-template should not be initialized without creating an embedded view","articleBody":"In Angular Material, our tabs API looks like this:\r\n```html\r\n\u003cmd-tab-group>\r\n \u003cmd-tab label=\"Overview\"> ... \u003c/md-tab>\r\n \u003cmd-tab label=\"API\"> ... \u003c/md-tab>\r\n \u003cmd-tab label=\"Examples\"> ... \u003c/md-tab>\r\n\u003c/md-tab>\r\n```\r\n\r\nThe template for the `\u003cmd-tab>` component looks like this:\r\n```html\r\n\u003cng-template>\u003cng-content>\u003c/ng-content>\u003c/ng-template>\r\n```\r\n\r\nWe then use this `\u003cng-template>` to manually create an embedded view based on which tab is active. However, the contents of each tab are _all_ initialized automatically before any embedded view is created. This can lead to less-than-ideal performance scenarios, since far more content than is necessary can be initialized. It's also worth noting that the \"phantom\" component instances in the content aren't destroyed immediately (even though they're not rendered anywhere), so they're likely taking up memory and cycles for no reason.\r\n\r\n[Plunker example of this behavior.](http://plnkr.co/edit/I0LMK3CkkA319NxQeVMn?p=preview)\r\n\r\nChatted w/ @robwormald and @mhevery and both agreed that behavior does seem unexpected since `ng-template` is supposed to be inert until it is embedded. \r\n\r\ncc @pkozlowski-opensource who mentioned that this is of interest for ng-bootstrap as well. ","author":{"url":"https://github.com/jelbourn","@type":"Person","name":"jelbourn"},"datePublished":"2017-08-14T23:49:26Z","url":"https://github.com/angular/angular/issues/18691"}
| 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:faf6886d-1211-71e8-1edd-29289807ccda |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D342:FC5BE:2142458:2C1C4B7:6B018315 |
| html-safe-nonce | d324e5084337e151cee1a07f08c5f67bfb0ca816970f8c43fdbf2fcf38acaa1c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzQyOkZDNUJFOjIxNDI0NTg6MkMxQzRCNzo2QjAxODMxNSIsInZpc2l0b3JfaWQiOiI2MDM1Njg4ODk5NzI3MTY0MTgxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c2fea5e76db223b5eefa9a8a71fc4c3e47dea73029c16de62e0826676757bb8b |
| hovercard-subject-tag | issue:250184917 |
| 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/18691/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eff278e0d49fa4447ef3fa2bf1828e1e363568ae51a80a1f8deab6755c54f156/angular/angular/issues/18691 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eff278e0d49fa4447ef3fa2bf1828e1e363568ae51a80a1f8deab6755c54f156/angular/angular/issues/18691 |
| og:image:alt | In Angular Material, our tabs API looks like this: |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jelbourn |
| 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