javascript - Angular ng-repeat $index -


i'm creating list of items user can click go next picture.

<ol class="indicators"> <li ng-repeat="img in pics" ng-click="slideto($index)"></li> </ol> 

this code works problem doesnt fill in $index in ngclick directive. resulting html:

<li ng-repeat="img in pics" ng-click="slideto($index)" class="ng-scope"></li> 

if put $index in between {{ }}, work, error in console.

resulting html:

<li ng-repeat="img in pics" ng-click="slideto(0)" class="ng-scope"></li> 

error:

error: [$parse:syntax] http://errors.angularjs.org/1.3.15/$parse/syntax?p0=%7b&p1=invalid%20key&p2=10&p3=slideto(%7b%7bnanndex%7d%7d)&p4=%7b%index%7d%7d

i've seen examples of dont use curly brackets $index used in child element , not element itself.

could tell me i'm doing wrong , when should use {{ }} when using angular expressions.

inspector not show filled in, however, if try logging parameter passed function see indeed corresponding index number item clicked on.


Comments

Popular posts from this blog

angularjs - Redirect to a new template in angular js -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

Desktop Launcher for Python Script Starts Program in Wrong Path (Linux) -