Title: Wrong content children order when using ngTemplateOutlet to render · Issue #57891 · angular/angular · GitHub
Open Graph Title: Wrong content children order when using ngTemplateOutlet to render · Issue #57891 · angular/angular
X Title: Wrong content children order when using ngTemplateOutlet to render · Issue #57891 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Content children should follow dom order but rendering conditionally with ngTemplateOutlet in a different order than ng-template declaration...
Open Graph Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Content children should follow dom order but rendering conditionally with ngTemplateOutlet in a diff...
X Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Content children should follow dom order but rendering conditionally with ngTemplateOutlet in a diff...
Opengraph URL: https://github.com/angular/angular/issues/57891
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wrong content children order when using ngTemplateOutlet to render","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncore\n\n### Is this a regression?\n\nNo\n\n### Description\n\nContent children should follow dom order but rendering conditionally with ngTemplateOutlet in a different order than ng-template declaration seems to confuse angular. I would expect the order to be based on the resulting DOM and not on the ng-template declaration order.\r\n\r\nThere should be no difference between:\r\n```html\r\n\u003capp-parent>\r\n \u003capp-child [order]=\"1\">\u003c/app-child>\r\n \u003capp-child [order]=\"2\">\u003c/app-child>\r\n\u003c/app-parent>\r\n```\r\nand\r\n```html\r\n\u003capp-parent> \u003c!-- WRONG ORDER -->\r\n \u003cng-container *ngTemplateOutlet=\"one\">\u003c/ng-container>\r\n \u003cng-container *ngTemplateOutlet=\"two\">\u003c/ng-container>\r\n \u003cng-template #two>\r\n \u003capp-child [order]=\"2\">\u003c/app-child>\r\n \u003c/ng-template>\r\n \u003cng-template #one>\r\n \u003capp-child [order]=\"1\">\u003c/app-child>\r\n \u003c/ng-template>\r\n\u003c/app-parent>\r\n```\r\nand\r\n```html\r\n\u003capp-parent> \u003c!-- NOT WORKING AT ALL -->\r\n \u003cng-container *ngTemplateOutlet=\"one2\">\u003c/ng-container>\r\n \u003cng-container *ngTemplateOutlet=\"two2\">\u003c/ng-container>\r\n\u003c/app-parent>\r\n\u003cng-template #two2>\r\n \u003capp-child [order]=\"2\">\u003c/app-child>\r\n\u003c/ng-template>\r\n\u003cng-template #one2>\r\n \u003capp-child [order]=\"1\">\u003c/app-child>\r\n\u003c/ng-template>\r\n```\r\n\r\nI might be doing something wrong - but is there a solution for it? I know switching the templates order \"fixes\" it but I can't do that and that's not a real fix.\n\n### Please provide a link to a minimal reproduction of the bug\n\nhttps://stackblitz.com/edit/stackblitz-starters-5qy9kg?file=src%2Fmain.ts\n\n### Please provide the exception or error you saw\n\n```true\nThe third example is out of order while the fourth example isn't even working\n```\n\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular 18\n```\n\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/Harpush","@type":"Person","name":"Harpush"},"datePublished":"2024-09-19T22:21:45Z","url":"https://github.com/angular/angular/issues/57891"}
| 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:140ab6ea-2a12-582c-4a7b-7797a2236663 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F2E:2DBB21:29118E6:36D56E7:6B01BC52 |
| html-safe-nonce | e45511d8818b8a6322ead899c6083f7e50da15d7c775747ac0cc09cc3d2fe9b3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjJFOjJEQkIyMToyOTExOEU2OjM2RDU2RTc6NkIwMUJDNTIiLCJ2aXNpdG9yX2lkIjoiNjIyNTI1OTg0NDExNTQ3OTYzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 25b50b6bd57ee7468b4453a885bb444da04bcb10cc2bafc7bcd8798349805df1 |
| hovercard-subject-tag | issue:2537461960 |
| 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/57891/issue_layout |
| twitter:image | https://opengraph.githubassets.com/964a9a9039cacb4a69515e3218c2c7b66d9cefa60b7f9de8b312f232676026c3/angular/angular/issues/57891 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/964a9a9039cacb4a69515e3218c2c7b66d9cefa60b7f9de8b312f232676026c3/angular/angular/issues/57891 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Content children should follow dom order but rendering conditionally with ngTemplateOutlet in a diff... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Harpush |
| 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