mouseenter and mouseleave in angular code example
Example 1: angular mouseenter
<div (mouseover)="changeText=true" (mouseout)="changeText=false">
<span *ngIf="!changeText">Hide</span>
<span *ngIf="changeText">Show</span>
</div>
Example 2: angular mouseenter
<div (mouseover)="changeText=true" (mouseout)="changeText=false">
<span [hidden]="changeText">Hide</span>
<span [hidden]="!changeText">Show</span>
</div>
Example 3: angular mouseenter
enter(i) {
this.hoverIndex = i;
}
leave(i) {
this.hoverIndex = null;
}
Example 4: angular mouseenter
<div *ngFor="let i of [1,2,3,4]" > hover me please.
<span class="only-show-on-hover">you only see me when hovering</span>
</div>