In my Angular project, I have a div with a background image. When I hover over it, a new class gets added.
Right, when I hover over it, I want to set the opacity of the background image.
I have looked for answers here
Can I set an opacity only to the background image of a div?
but those solutions require that I know the url. Since my url is dynamic and is individual for every component, I have to do it in the template.
Or in code format:
[style.background-image]="
linear-gradient(
rgba(255, 255, 255, 0.5),
rgba(255, 255, 255, 0.5)
), url( + thumbnailPathGenerator() + )
"
I am trying to use the first solution from the link in my template. It may be not the prettiest way to do it, but this is the only solution I can think of. I tried setting the commas correctly, but I am doing that incorrectly always.
How to write those multiple css commands in the style.background-image without getting the error marks?