Reputation: 740
i am using ng-repeat to populate a image list. i need to use $index for naming the images and use it for replacing src of preview div. $index is not replacing in mouseover section while its getting replaced in name section. what can be the reason and how to correct it.
<img onmouseover="preview.src=img{{$index}}.src" name="img{{$index}}" src="{{image.SMALL_PATH}}" alt="" ng-repeat="image in images | filter:query"/>
<div class="preview" align="center">
<img name="preview" src="images/img1.jpg" alt=""/>
</div>
Upvotes: 0
Views: 59
Reputation: 4645
Use ng-src
and ng-mouseover
Your snippet would be
<img data-ng-mouseover="preview.src=image.src" name="image.name" data-ng-src="image.SMALL_PATH" alt="" ng-repeat="image in images | filter:query"/>
Upvotes: 0