Reputation: 8920
I want to call a function fadeOut()
passing to it an index number generated by ng-repeat. I tried this
<img ng-src={{element.image}} class="portofolio-image"
id="portofolio-image{{$index}}"
ng-click="fadeOut({{$index}})">
but there is a parsing error, and this
<img ng-src={{element.image}} class="portofolio-image"
id="portofolio-image{{$index}}"
ng-click="fadeOut('{{$index}}')">
which passes the "{{$index}}" string. Any idea how can I solve this?
Upvotes: 3
Views: 112
Reputation: 1421
You can use fadeOut($index) as follows:
<img ng-src={{element.image}}
class="portofolio-image"
id="portofolio-image{{$index}}"
ng-click="fadeOut($index)">
Upvotes: 8