3

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?

1
  • 7
    ng-click="fadeOut($index)" without curly brackets Commented Mar 25, 2014 at 7:08

1 Answer 1

8

You can use fadeOut($index) as follows:

    <img ng-src={{element.image}} 
     class="portofolio-image" 
     id="portofolio-image{{$index}}" 
     ng-click="fadeOut($index)">
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.