Is there a way to dynamically change the background color based on component interaction?
I am looking for a method to compare the target element with the current element.
For example, here is a hypothetical scenario:
<span
[style.background]="targetElem == this ? 'red' : '#eee'"
(click)="targetElem = $event.target" >any text ...</span>
<span
[style.background]="targetElem == this ? 'red' : '#eee'"
(click)="targetElem = $event.target" >any text ...</span>
<span
[style.background]="targetElem == this ? 'red' : '#eee'"
(click)="targetElem = $event.target" >any text ...</span>
enter code here
What is the best way to access elements(this) from within component interaction?