Title: Directly Importing Template Dependencies in HTML Templates · Issue #56125 · angular/angular · GitHub
Open Graph Title: Directly Importing Template Dependencies in HTML Templates · Issue #56125 · angular/angular
X Title: Directly Importing Template Dependencies in HTML Templates · Issue #56125 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? compiler Description Currently, template dependencies for standalone components are imported and configured within TypeScript files, even though their main applicat...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? compiler Description Currently, template dependencies for standalone components are imported and configured within TypeScrip...
X Description: Which @angular/* package(s) are relevant/related to the feature request? compiler Description Currently, template dependencies for standalone components are imported and configured within TypeScrip...
Opengraph URL: https://github.com/angular/angular/issues/56125
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Directly Importing Template Dependencies in HTML Templates","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\ncompiler\r\n\r\n### Description\r\n\r\nCurrently, template dependencies for standalone components are imported and configured within TypeScript files, even though their main application is within HTML templates. This establishes a gap between where the dependencies are defined and where they are implemented.\r\n\r\n### Proposed solution\r\n\r\nI propose a syntax that allows dependencies to be directly imported into the HTML template files. Taking inspiration from the proposed \"let syntax\" #15280 , the proposed syntax could be:\r\n\r\n```html\r\n@import {NgClass , NgStyle} from \"@angular/common\"\r\n\u003cdiv [NgClass]=\"something\" \u003e\u003c/div\u003e\r\n\u003c!-- or --\u003e\r\n\u003cdiv [ngStyle]=\"something\" \u003e\u003c/div\u003e\r\n\r\n@defer(..){\r\n @import {SomeComponet} from \"something\";\r\n \u003cSomeComponet /\u003e\r\n \u003c!-- or --\u003e\r\n \u003csome-componet /\u003e\r\n}\r\n```\r\nMoreover, Imports could also be scoped to deferred blocks for lazy loading.\r\n\r\n### Alternatives considered\r\n\r\nNone","author":{"url":"https://github.com/abdulkareemnalband","@type":"Person","name":"abdulkareemnalband"},"datePublished":"2024-05-28T10:02:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/56125/angular/issues/56125"}
| 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:a0af4c27-6c75-9f2a-af26-becbf4046e0b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A200:340321:59B051B:741E695:69754239 |
| html-safe-nonce | 516a8ab46c40cbbb995ee225f94ea67ab7f7bd42fbe298ef4314b805856ebe64 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjAwOjM0MDMyMTo1OUIwNTFCOjc0MUU2OTU6Njk3NTQyMzkiLCJ2aXNpdG9yX2lkIjoiMzA3MTU5ODM3ODA2ODgyMDUzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 858d403668d472dad345bc2876ca4bde8d514ce0f37ef397a90bdcd858f12a91 |
| hovercard-subject-tag | issue:2320646221 |
| 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/56125/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ad4a055fef7403fc78a4f4f282d835ab48a7a41728ecd01767b18c58e1a47f55/angular/angular/issues/56125 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ad4a055fef7403fc78a4f4f282d835ab48a7a41728ecd01767b18c58e1a47f55/angular/angular/issues/56125 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? compiler Description Currently, template dependencies for standalone components are imported and configured within TypeScrip... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abdulkareemnalband |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| 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 | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width