Title: ES6 template literal expressions not working past v9 · Issue #35584 · angular/angular · GitHub
Open Graph Title: ES6 template literal expressions not working past v9 · Issue #35584 · angular/angular
X Title: ES6 template literal expressions not working past v9 · Issue #35584 · angular/angular
Description: 🐞 bug report Is this a regression? Yes, the previous version in which this bug was not present was: ^8 Description Using a template literal expression used to work until Angular 9, for as long as the template lived in the TS source not i...
Open Graph Description: 🐞 bug report Is this a regression? Yes, the previous version in which this bug was not present was: ^8 Description Using a template literal expression used to work until Angular 9, for as long as t...
X Description: 🐞 bug report Is this a regression? Yes, the previous version in which this bug was not present was: ^8 Description Using a template literal expression used to work until Angular 9, for as long as t...
Opengraph URL: https://github.com/angular/angular/issues/35584
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ES6 template literal expressions not working past v9","articleBody":"# 🐞 bug report\r\n\r\n### Is this a regression?\r\n\r\n\u003c!-- Did this behavior use to work in the previous version? -->\r\n\u003c!-- ✍️--> Yes, the previous version in which this bug was not present was: ^8\r\n\r\n### Description\r\n\r\n\u003c!-- ✍️-->\r\n\r\nUsing a template literal expression used to work until Angular 9, for as long as the template lived in the TS source not in HTML (_obviously_).\r\n\r\nSince Angular 9 that does not work any longer in one scenario. I am mostly focusing on library builds here:\r\n\r\n**Working**\r\n- build library with Angular 9 Ivy & serve the Angular 9 application\r\n- build library with Angular 8 View Engine & serve the Angular 8 application\r\n- build library with Angular 8 View Engine & serve the Angular 9 application (`ngcc`)\r\n\r\n**Not working**\r\n- build library with Angular 9 View Engine (`ng build lib --prod`) & serve the Angular 9 application (`ngcc`)\r\n\r\n## 🔬 Minimal Reproduction\r\n\r\nIn any Angular workspace create a library and do the following:\r\n\r\n```ts\r\nconst enum Demo {\r\n First\r\n}\r\n\r\n@Component({\r\n template: `\r\n Static variable: ${ Demo.First }\r\n `\r\n})\r\nexport class DemoComponent {}\r\n```\r\n\r\n## 🔥 Exception or Error\r\n```\r\nerror NG1010: template must be a string\r\n```\r\n\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n```\r\nAngular CLI: 9.0.3\r\nNode: 12.15.0\r\nOS: darwin x64\r\n\r\nAngular: 9.0.2\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... language-service, platform-browser, platform-browser-dynamic\r\n... router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n------------------------------------------------------------\r\n@angular-devkit/architect 0.900.3\r\n@angular-devkit/build-angular 0.900.3\r\n@angular-devkit/build-ng-packagr 0.900.3\r\n@angular-devkit/build-optimizer 0.900.3\r\n@angular-devkit/build-webpack 0.900.3\r\n@angular-devkit/core 9.0.3\r\n@angular-devkit/schematics 9.0.3\r\n@angular/cdk 9.0.1\r\n@angular/cli 9.0.3\r\n@angular/material 9.0.1\r\n@ngtools/webpack 9.0.3\r\n@schematics/angular 9.0.3\r\n@schematics/update 0.900.3\r\nng-packagr 9.0.1\r\nrxjs 6.5.4\r\ntypescript 3.7.5\r\nwebpack 4.41.2\r\n```\r\n\r\n**Anything else relevant?**\r\n\r\nI am not 100% sure this was ever officially supported, even though I would have hoped so, since it is native ES6 feature. If it wasn't supported, please close the issue.\r\n\r\nInteresting observation is, that View Engine compiled library from Angular 8 is correctly processed by `ngcc`, while View Engine from Angular 9 surprisingly fails.\r\n\r\n---\r\n\r\n**EDIT**: Seems like an easy reproduction mentioned above is not reproducible any more. I can still reproduce it, if I use literal expressions while binding to input, e.g.: `[title]=\"${variable}\"`.\r\n\r\nReproduction:\r\n- Clone: https://github.com/klemenoslaj/template-literal-expressions-issue\r\n- Execute: `yarn && yarn reproduce`\r\n\r\nResulting in error:\r\n\r\n```\r\ndist/example/fesm2015/example.js:29:19 - error NG1010: template must be a string\r\n\r\n29 template: `\r\n ~\r\n30 \u003cbutton [title]=\"${ButtonType.Button}\">Button\u003c/button>\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n31 `\r\n ~~~\r\ndist/example/fesm2015/example.js:39:24 - error NG6001: The class 'ExampleComponent' is listed in the declarations of the NgModule 'ExampleModule', but is not a directive, a component, or a pipe.\r\n```","author":{"url":"https://github.com/klemenoslaj","@type":"Person","name":"klemenoslaj"},"datePublished":"2020-02-20T15:06:04Z","url":"https://github.com/angular/angular/issues/35584"}
| 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:55377d15-fcfc-b786-0563-e672ed9a24ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 940C:23CF06:136AE45:18E1731:6B01149C |
| html-safe-nonce | 8f72481438ec6e101a58fb0fb7f93f2cc39dc3adb078ffcdfe338ac4dd1f0b91 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDBDOjIzQ0YwNjoxMzZBRTQ1OjE4RTE3MzE6NkIwMTE0OUMiLCJ2aXNpdG9yX2lkIjoiOTAyOTYwNDI3MDI0MDYxNTk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f1b7dca1cc26b84c27efb460d40a38a7f246f0926adf82f6db72dc2231e05139 |
| hovercard-subject-tag | issue:568363922 |
| 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/35584/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d642a8bb278e448ddf1c47ea47b0341c26024e743748bffa2cbdbbdc879562bd/angular/angular/issues/35584 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d642a8bb278e448ddf1c47ea47b0341c26024e743748bffa2cbdbbdc879562bd/angular/angular/issues/35584 |
| og:image:alt | 🐞 bug report Is this a regression? Yes, the previous version in which this bug was not present was: ^8 Description Using a template literal expression used to work until Angular 9, for as long as t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | klemenoslaj |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width