Title: Support providing a space-separated list of classes when using [class] bindings with an array literal. · Issue #54605 · angular/angular · GitHub
Open Graph Title: Support providing a space-separated list of classes when using [class] bindings with an array literal. · Issue #54605 · angular/angular
X Title: Support providing a space-separated list of classes when using [class] bindings with an array literal. · Issue #54605 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? Yes Description Host property on Angular Component decorator doesnt apply more than one class. @HostBinding works fine. Code example: This works just fine....
Open Graph Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? Yes Description Host property on Angular Component decorator doesnt apply more than one class. @HostBinding works f...
X Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? Yes Description Host property on Angular Component decorator doesnt apply more than one class. @HostBinding works f...
Opengraph URL: https://github.com/angular/angular/issues/54605
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support providing a space-separated list of classes when using [class] bindings with an array literal.","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncore\n\n### Is this a regression?\n\nYes\n\n### Description\n\nHost property on Angular Component decorator doesnt apply more than one class. @HostBinding works fine. \r\n\r\nCode example:\r\n\r\nThis works just fine. Every class is an element of an array. even the calculated one is ok. \r\n\r\n host: {\r\n '[class]': `['flex', 'max-w-max', orientation === 'row' && !reversed ? 'flex-row': '',]`,\r\n },\r\n\r\nHowever this doesn't work. Two classes in a string are not added to element class:\r\n\r\n host: {\r\n '[class]': `['bg-primary p-10']`,\r\n },\r\n\r\nWhen used with @HostBinding works just fine:\r\n\r\n @HostBinding('attr.class')\r\n get Classes() {\r\n return ['bg-primary p-10']\r\n }\r\n \r\n Same story happens with strings returned by functions:\r\n\r\n host: { '[class]': `[getOrientationDirection(orientation), getOrientationAlign(orientation), getGap(elementGap)]`, },\r\n\r\nThis works, as long as each returns ONLY ONE class, for example:\r\n\r\n getOrientationDirection(orientation: AppFlexDirection) {\r\n if (orientation === 'row') {\r\n return 'flex-row';\r\n }\r\n return '';\r\n }\r\n\r\nWhen returning 2 classes it doesnt work. So after extensive testing i came into conclusion, that the implementation of host is not working very well with tailwind, however @HostBinding works just fine, however its now a legacy feature, cant be fully replaced by host at this point.\r\n\r\n\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n_No response_\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI: 17.0.9\r\nNode: 20.10.0\r\nPackage Manager: npm 10.2.3\r\nOS: darwin arm64\r\n\r\nAngular: 17.0.8\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... localize, platform-browser, platform-browser-dynamic\r\n... platform-server, router\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1700.9\r\n@angular-devkit/build-angular 17.0.9\r\n@angular-devkit/core 17.0.9\r\n@angular-devkit/schematics 17.0.9\r\n@angular/cdk 17.0.5\r\n@angular/cli 17.0.9\r\n@angular/material 17.0.5\r\n@angular/ssr 17.0.9\r\n@schematics/angular 17.0.9\r\nrxjs 7.8.1\r\ntypescript 5.2.2\r\nwebpack 5.89.0\r\nzone.js 0.14.2\n```\n\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/Profana92","@type":"Person","name":"Profana92"},"datePublished":"2024-02-26T13:49:39Z","url":"https://github.com/angular/angular/issues/54605"}
| 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:d8865fc3-582a-dbae-7364-f0e0e200c204 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E12C:24A0A:E7D3AA:12382E7:6B013AC6 |
| html-safe-nonce | dd600ee84f9281a54dd78e4796b23d17783ed96452fc6f4ea289a9cea1591525 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTJDOjI0QTBBOkU3RDNBQToxMjM4MkU3OjZCMDEzQUM2IiwidmlzaXRvcl9pZCI6IjM4MDg1OTUwMTc4Mjg3NDM4NzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 928bfffc00caf75716626a299192327b9ba4715394c660d0ac3bfb5d7d9ab3de |
| hovercard-subject-tag | issue:2154232467 |
| 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/54605/issue_layout |
| twitter:image | https://opengraph.githubassets.com/53da5ee1da3061fd45f2020adf61da9ed8fdd85fad4ccd64322813cb5f2188b7/angular/angular/issues/54605 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/53da5ee1da3061fd45f2020adf61da9ed8fdd85fad4ccd64322813cb5f2188b7/angular/angular/issues/54605 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? core Is this a regression? Yes Description Host property on Angular Component decorator doesnt apply more than one class. @HostBinding works f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Profana92 |
| 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