TypeScript:
displayText: boolean = false;
showOnHover(){
this.displayText = true
}
hideOnLeave(){
this.displayText = false;
}
Html
<ul>
<li class="txt-block"
*ngFor='let element of elementsToDisplay;let i = index'>
<div class="form-control">
<input type='text' (mouseenter)="showOnHover()" (mouseleave)="hideOnLeave()" id = 'elmt'+i name='element'/>
<span *ngIf = 'displayText'> {{element}} </span>
</li>
</ul>
This code dynamically creates textboxes using ngFor. When a mouse enters a textbox, the corresponding Span element should be displayed.
However, currently when hovering over a specific text box, all Span elements are being shown. Assistance in resolving this issue would be greatly appreciated.