- I am dealing with 2 directives:
wa-hotspots
andwa-tooltips
. - When the
ng-mouseover
event occurs onwa-hotspots
, it takes the $index ofwa-hotspot
and adjusts the visibility and position ofwa-tooltip
usingng-class:on
andng-style="tooltipCoords"
by matching the indexes. - Note: Since both
wa-hotspots
andwa-tooltips
share the same collection namedpage.hotspots
, they also share the same index throughng-repeat
.
The Issue:
The problem arises when hovering over wa-hotspots
sets the ng-style
position for ALL elements in wa-tooltips
. I want it to set the style only for the corresponding matching index. Even though visibility is controlled by ng-class, this extra styling seems unnecessary and inefficient.
Hence:
Query:
How can I ensure that my ng-style only styles the relevant tooltip that matches the shared index, rather than applying it to all wa-tooltips
upon hovering over wa-hotspots
?
<ul id="wa-page-{{page.pageindex}}" class="wa-page-inner" ng-mouseleave="pageLeave()">
<li wa-hotspots
<map name="wa-page-hotspot-{{page.pageindex}}">
<area ng-repeat="hotspot in page.hotspots"
class="page-hotspot"
shape="{{hotspot.areashape}}"
coords="{{hotspot.coordinatetag_scaled}}"
ng-mouseover="showTooltip($index, hotspot.coordinatetag_scaled)"
ng-mouseout="hideTooltip()">
</map>
</li>
<li class="tooltip-wrapper">
<ul class="tooltip">
<li wa-tooltips
ng-repeat="hotspot in page.hotspots"
ng-class="{on: hovered.index == $index}"
ng-mouseover="hovered.active == true"
ng-mouseout="hovered.active == false"
ng-style="tooltipCoords" hotspot="hotspot">
</li>
</ul>
</li>
</ul>
tooltip: