Title: Proposal: Allow computed property names in map expressions · Issue #13855 · angular/angular · GitHub
Open Graph Title: Proposal: Allow computed property names in map expressions · Issue #13855 · angular/angular
X Title: Proposal: Allow computed property names in map expressions · Issue #13855 · angular/angular
Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not submit support request here, instead see https://github.com/an...
Open Graph Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not submit support request...
X Description: I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not su...
Opengraph URL: https://github.com/angular/angular/issues/13855
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Proposal: Allow computed property names in map expressions","articleBody":"\u003c!--\r\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\r\n-->\r\n\r\n**I'm submitting a ...** (check one with \"x\")\r\n```\r\n[ ] bug report => search github for a similar issue or PR before submitting\r\n[x] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nThe expression parser currently doesn't support ES2015 computed property names, which allow to put an expression between brackets [] that will be computed as the property name.\r\n\r\nExample of what's not currently supported:\r\n```html\r\n\u003cdiv [ngClass]=\"{[className1]: true, [className2]: foo()}\">\u003c/div>\r\n```\r\n*`className1` and `className2` are properties in the controller that contain the actual class names.*\r\n\r\nThis can be overcome by creating a property/function in the component class.\r\n```js\r\nget myClasses() {\r\n let self = this;\r\n return {\r\n [self.className1]: true,\r\n [self.className2]: self.foo()\r\n };\r\n}\r\n```\r\n```html\r\n\u003cdiv [ngClass]=\"myClasses\">\u003c/div>\r\n```\r\n**Expected behavior**\r\nFirst example to work.\r\n\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nThis would avoid the need for creating such properties in the component.\r\n\r\n**Please tell us about your environment:**\r\n\u003c!-- Operating system, IDE, package manager, HTTP server, ... -->\r\n\r\n* **Angular version:** 2.3.1\r\n\r\n","author":{"url":"https://github.com/santialbo","@type":"Person","name":"santialbo"},"datePublished":"2017-01-10T10:05:57Z","url":"https://github.com/angular/angular/issues/13855"}
| 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:a60dc034-5373-3ed7-735a-6814b7284610 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C98C:26ECEB:18FFA53:1FDBC7D:6B013144 |
| html-safe-nonce | 19bba36a2a648fffb5a48199bb01785bb204ccc1bef050f114e8ee5838556ee7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOThDOjI2RUNFQjoxOEZGQTUzOjFGREJDN0Q6NkIwMTMxNDQiLCJ2aXNpdG9yX2lkIjoiNTMzODkwNzc5OTcyMjIwOTYwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4e71e92c4985d4d4e6b0afbf41140f0f3d9dda175661cf233de081ecb14eb094 |
| hovercard-subject-tag | issue:199779219 |
| 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/13855/issue_layout |
| twitter:image | https://opengraph.githubassets.com/95d4b970637221346994ab5bc6ade94f13aca99064ea4f0f7f44a78e32a6e698/angular/angular/issues/13855 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/95d4b970637221346994ab5bc6ade94f13aca99064ea4f0f7f44a78e32a6e698/angular/angular/issues/13855 |
| og:image:alt | I'm submitting a ... (check one with "x") [ ] bug report => search github for a similar issue or PR before submitting [x] feature request [ ] support request => Please do not submit support request... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | santialbo |
| 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