Title: ng-content, slot and content elements don't work with nested Angular custom elements · Issue #24536 · angular/angular · GitHub
Open Graph Title: ng-content, slot and content elements don't work with nested Angular custom elements · Issue #24536 · angular/angular
X Title: ng-content, slot and content elements don't work with nested Angular custom elements · Issue #24536 · angular/angular
Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or request [ ] Support request => Please do not submi...
Open Graph Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or request [ ...
X Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or reques...
Opengraph URL: https://github.com/angular/angular/issues/24536
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ng-content, slot and content elements don't work with nested Angular custom elements","articleBody":"\u003c!--\r\nPLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.\r\n\r\nISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.\r\n--\u003e\r\n\r\n## I'm submitting a...\r\n\u003c!-- Check one of the following options with \"x\" --\u003e\r\n\u003cpre\u003e\u003ccode\u003e\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[x] Bug report \u003c!-- Please search GitHub for a similar issue or PR before submitting --\u003e\r\n[ ] Performance issue\r\n[ ] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request =\u003e Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n[ ] Other... Please describe:\r\n\u003c/code\u003e\u003c/pre\u003e\r\n\r\n## Current behavior\r\nCurrently, when you have nested Angular custom elements, and the child element contains ng-content, content or slot elements in its template, content projection/insertion points don't work. Here's a more detailed explanation of the behavior:\r\n\r\n For the sake of the example, let's have two Angular components - container and button. Button uses content projection and the template of the container component has nested button inside it. \r\n\r\nTried all kinds of scenarios with nested custom elements - using the content element from v.0 of ShadowDom, the slot from v. 1 and ng-content and placing them in the app.component.html, in the angular html page in the src folder, as well as on a separately hosted html page, where I'm loading my elements bundles, generated after a production build (following this approach: https://medium.com/@tomsu/building-web-components-with-angular-elements-746cd2a38d5b).\r\n\r\nHere's what I noticed:\r\n\r\n## 'slot' and 'content' elements behave similarly\r\n1. Insertion points work for both the button and the container, when they are placed in the app.component's template.\r\n2. In the angular src/html - the button's content doesn't show up. The content of the button in the container shows up.\r\n3. On the separately hosted html page - same behavior as 2.\r\n\r\nYou can check a demo with slots here: https://stackblitz.com/edit/angular-6jmqbg\r\n\r\n## ng-content\r\n1. Content projection doesn't work when the button and the container are placed in the app.component.\r\n2. On the src/html page - ng-content works for the button, but doesn't work in the container.\r\n3. In the external html - same as 2 \r\n\r\nYou can check a demo project with ng-content here: https://stackblitz.com/edit/angular-uxthfz\r\n\r\n## Expected behavior\r\nShadow dom insertion points or/and content projection should work in nested Angular custom elements\r\n\r\n## Minimal reproduction of the problem with instructions\r\nYou can check a demo with slots here: https://stackblitz.com/edit/angular-6jmqbg\r\nYou can check a demo project with ng-content here: https://stackblitz.com/edit/angular-uxthfz\r\n\r\n## What is the motivation / use case for changing the behavior?\r\n\r\nI'm mostly interested in the last case - in which I'm loading the bundled elements on a a separately hosted html page (external application). It's pretty blocking for us, because most of our components are complex and contain other components in their templates. \r\n\r\nThanks, guys! :cake:\r\n\r\n## Environment\r\n\r\n\u003cpre\u003e\u003ccode\u003e\r\nAngular version: 6.0.0\r\n\u003c!-- Check whether this is still an issue in the most recent Angular version --\u003e\r\n\r\n\r\n","author":{"url":"https://github.com/JenPeleva","@type":"Person","name":"JenPeleva"},"datePublished":"2018-06-15T12:01:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/24536/angular/issues/24536"}
| 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:8aee5e74-b641-f836-2a48-04a3a7996774 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5C4:32AC14:A5A6E0C:DF02D17:6A5EAEB9 |
| html-safe-nonce | e97408dda6a022c3bf13bb904372243a5882640f305527618631efd62cf3b8ee |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUM0OjMyQUMxNDpBNUE2RTBDOkRGMDJEMTc6NkE1RUFFQjkiLCJ2aXNpdG9yX2lkIjoiNTczNDQ3ODc3MTYxOTAxNjM3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 619fca9ed6755ee43c60a45ae19d72f2d669afbcbe19622fbbdd97b9a2f81ddb |
| hovercard-subject-tag | issue:332747824 |
| 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/24536/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1d1e059c748b7cca22ce0741ecc8304301297ed648c5c090e799e5ad809a0a44/angular/angular/issues/24536 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1d1e059c748b7cca22ce0741ecc8304301297ed648c5c090e799e5ad809a0a44/angular/angular/issues/24536 |
| og:image:alt | I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [x] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or request [ ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JenPeleva |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7129250e6854dcc7bfa46fc877bb154b96762b31e3fa82fdf0697c71f08bb32c |
| 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 | 3084c198d559e243975a7a7f61d0b80bcea2a724 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width