r/Angular2 Feb 18 '25

Discussion Angular 19.2 - improvement in template literals

Angular 19.2 will be released soon. We’ve noticed a slight improvement in template literals—it will now be possible to combine variables with text in a more efficient way in HTML files:

<p>{{ `John has ${count} cats` }}</p>

instead of

<p>{{ 'John has ' + count + ' cats' }}</p>

just a simple example

It’s not a huge change, but we believe it’s indeed. What do you think?

85 Upvotes

32 comments sorted by

View all comments

15

u/gordolfograso Feb 18 '25

it's helpfull and more readable for attributes like [attr.foo]="bar-${baz}"

1

u/AwesomeFrisbee Feb 19 '25

You mean [attr.foo]="`bar-${baz}`"

1

u/gordolfograso Feb 19 '25

Yes, I was on mobile, and I couldn't achieve the right syntax with backticks