I use opacity: 0 for my class .best-match.
The CSS (Sass) looks like this:
.best-match
opacity: 0
This is what I see in my browser:
.best-match[_ngcontent-tli-c4] {
opacity: 0;
}
I would like to check with JavaScript if the property is set to 0. I have tried it with
if (document.querySelector('.best-match').style.opacity === '0') { ... }
but the output is always false. I have also tried it with @ViewChild():
if (this.bestMatchContainer.nativeElement.style.opacity === '0') { ... }
but that also returns false. What's wrong with my code?