AngularJS - {{$index}} within onclick

Dustin

I'm attempting to compile {{$index}} from a ng-repeat inside an onclick. Setup looks like this.

<div ng-repeat="stuff in things" >
<a href="#" onclick="superDuperFunction({{$index}});">Foo</a>
</div>

Except, I'm getting a console error instead of it {{$index}} compiling.

Error: [$compile:nodomevents] http://errors.angularjs.org/undefined/$compile/nodomevents
    at Error (<anonymous>)
    at http://localhost:3000/lib/angular.min.js:6:453
    at pre (http://localhost:3000/lib/angular.min.js:57:54)
    at S (http://localhost:3000/lib/angular.min.js:49:122)
    at h (http://localhost:3000/lib/angular.min.js:43:59)
    at h (http://localhost:3000/lib/angular.min.js:43:76)
    at h (http://localhost:3000/lib/angular.min.js:43:76)
    at h (http://localhost:3000/lib/angular.min.js:43:76)
    at http://localhost:3000/lib/angular.min.js:42:114
    at http://localhost:3000/lib/angular.min.js:183:186 <a href="#" onclick="superDuperFunction({{$index}});">

What am I doing wrong? Any help is appreciated!

Heikki

Try <a href="#" ng-click="superDuperFunction($index)">Foo</a>.

Docs/examples:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related