Title: Allow for iterative content projection with content children · Issue #61095 · angular/angular · GitHub
Open Graph Title: Allow for iterative content projection with content children · Issue #61095 · angular/angular
X Title: Allow for iterative content projection with content children · Issue #61095 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? core Description I have a situation where I am passing content to a wrapper component with multiple children of the same component type. I would like to be able to ...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? core Description I have a situation where I am passing content to a wrapper component with multiple children of the same com...
X Description: Which @angular/* package(s) are relevant/related to the feature request? core Description I have a situation where I am passing content to a wrapper component with multiple children of the same com...
Opengraph URL: https://github.com/angular/angular/issues/61095
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow for iterative content projection with content children","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\n\ncore\n\n### Description\n\nI have a situation where I am passing content to a wrapper component with multiple children of the same component type. I would like to be able to do something like this:\n\nMain component template\n```html\n\u003cmy-list>\n \u003cmy-list-item>List Item 1\u003c/my-list-item>\n \u003cmy-list-item>List Item 2\u003c/my-list-item>\n \u003cmy-list-item>List Item 3 \u003cinput type=\"text\" [(ngModel)]=\"myBoundVariable\" />\u003c/my-list-item>\n\u003c/my-list>\n```\n\n`my-list.component.ts`\n```typescript\n@Component({\n selector: 'my-list',\n template: `\n @for (item of listItems();; track item) {\n \u003c!-- item's content projected here with component's wrapping tag -->\n @if (!$last) {\n \u003chr />\n }\n }\n`\n})\nexport class MyListComponent {\n listItems = contentChildren(MyListItemComponent);\n}\n```\n`my-list-item.component.ts`\n```typescript\n@Component({\n selector: 'my-list-item',\n template: `\u003cng-content>\u003c/ng-content>`,\n styles: [':host { display: block; border: solid 1px red; }'],\n})\nexport class MyListItemComponent {}\n```\n\nThe desired end result would be\n```html\n\u003cmy-list>\n \u003cmy-list-item>List Item 1\u003c/my-list-item>\n \u003chr />\n \u003cmy-list-item>List Item 2\u003c/my-list-item>\n \u003chr />\n \u003cmy-list-item>List Item 3 \u003cinput type=\"text\" />\u003c/my-list-item>\n\u003c/my-list>\n```\n\n\n### Proposed solution\n\nBe able to pass the result of a Signal or QueryList to `ng-content` or another new addition to place specific instances of content children iteratively.\n\n### Alternatives considered\n\nThe current alternative is to pass whether the child is the last in the list via an input. This can become repetitive and adds additional effort for each component this kind of processing might need. Being able to iteratively project instead of just everything via `ng-content` or `ng-content` with `selector` would be very beneficial.","author":{"url":"https://github.com/trickeyone","@type":"Person","name":"trickeyone"},"datePublished":"2025-05-01T22:52:44Z","url":"https://github.com/angular/angular/issues/61095"}
| 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:2df86fa2-b860-fd52-b237-7c7cd975d5b7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFA0:63875:C00F32:FFB54B:6B00F3D5 |
| html-safe-nonce | 375eeef077e6ad08edc30ec5928df518d2d2fdced1877c4e558b965612c421ce |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkEwOjYzODc1OkMwMEYzMjpGRkI1NEI6NkIwMEYzRDUiLCJ2aXNpdG9yX2lkIjoiNDQ4ODY2ODM0Mjg2NDkwMTA3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | aecc8cbedaf92941faeb6ede328047090e0024f46264977d9c7a12637f953455 |
| hovercard-subject-tag | issue:3034862048 |
| 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/61095/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5020502715ff0f2537ef821cafbc021498f44296aa200d5f7115e3208b319f75/angular/angular/issues/61095 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5020502715ff0f2537ef821cafbc021498f44296aa200d5f7115e3208b319f75/angular/angular/issues/61095 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? core Description I have a situation where I am passing content to a wrapper component with multiple children of the same com... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trickeyone |
| 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