Interpolation in html attributes

How do you use interpolated strings in html attributes?

I’m attempting the following, but not working

 placeholder="`Filter By '${filterTypes}`"

ok so apparently you don’t need the back ticks, and single quotes will do

"Filter By '${filterTypes}'"

I’m not even sure you need to have those singlequotes '. If you want to, you can add them but they’re not necessary. Can you confirm ?

You don’t need single quotes unless you are wanting them to be displayed in the string. The string interpolation that is used in the templates is not the JS version where you have to have the ticks `` but works like it in that you can use ${var} with your HTML whether it’s in quotes or not.

Yes, i was (not for the first time today) being a complete idiot.

Don’t say that. If that’s true then we’re all idiots from time to time :slight_smile:

2 Likes