i18n with ivy breaks the injection of translated attribute
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by package @angular/localize.
Is this a regression?
Yes, this issue is reproducible only with Ivy. With ViewEngine it works fine.
Description
Injecting the attribute to the component/directive that is translated using i18n
is always resulting in null
.
Example:
text
is a directive that reads the text
attribute and simply adds the following text to the host element:
Text attribtue value is: <attribute value>
Code:
<div text="Text without i18n"></div>
<div i18n-text text="Text with i18n"></div>
Resulting HTML:
<div text="Text without i18n">Text attribtue value is: Text without i18n.</div>
<div text="Text with i18n">Text attribtue value is: null.</div>
Observed in the result above, text
attribute is properly set to Text with i18n
, while the injected value remains null
.
🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-ivy-uzgvwe
You can observe null
as described above.
To make this example work, open settings and uncheck Enable Ivy
. Now ViewEngine will be used to compile the application, and the null
text will be replaced by Text with i18n
.
🌍 Your Environment
Angular CLI: 10.0.4 Node: 12.16.3 OS: linux x64
Angular: 10.0.5 … animations, common, compiler, compiler-cli, core, forms … localize, platform-browser, platform-browser-dynamic, router Ivy Workspace: Yes
Package Version
@angular-devkit/architect 0.1000.4 @angular-devkit/build-angular 0.1000.4 @angular-devkit/build-optimizer 0.1000.4 @angular-devkit/build-webpack 0.1000.4 @angular-devkit/core 10.0.4 @angular-devkit/schematics 10.0.4 @angular/cli 10.0.4 @ngtools/webpack 10.0.4 @schematics/angular 10.0.4 @schematics/update 0.1000.4 rxjs 6.5.5 typescript 3.9.7 webpack 4.43.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Note that this involves an
@Attribute
decorator rather than an@Input
decorator to pass the value through. It does work if you use@Input
instead: https://stackblitz.com/edit/angular-ivy-af37h8?file=src%2Fapp%2Ftext.directive.tsThis issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.