user2696466
user2696466

Reputation: 740

$index in ng-repeat not getting replaced angularjs

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

Answers (1)

Vineet
Vineet

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

Related Questions