Intrepid Uliyar
Intrepid Uliyar

Reputation: 95

How to bind data of angularjs inside onClick as argument

I want to bind Angularjs data inside onClick function, I have tried, but it's not working.

In below example I want to bind index value inside onclick function. What's wrong with my code. Can anyone point out this..

/**Example:**/
<input type="text" ng-repeat="items in itemList" onClick=tab("{{$index}}") 

Upvotes: 0

Views: 424

Answers (1)

rfornal
rfornal

Reputation: 5122

I've done ...

ng-click="tab($index)"

This takes advantage of the fact that angular has it's own click; this allows for simpler variable declaration and passing.

Upvotes: 3

Related Questions