28

I want to do something like this:

<a ng-click="doSomething({{value}})" >

js

$scope.doSomething = function(a){
 console.log(a);
}
2
  • If value is defined on the controller's scope, just use "doSomething(value)". Commented Apr 9, 2013 at 15:56
  • According to the AngularJS documentation on ngClick you don't need curley braces for your variables. Commented Mar 19, 2014 at 0:24

1 Answer 1

58

all you need to do is this:

<a ng-click="doSomething(value)" >
Sign up to request clarification or add additional context in comments.

2 Comments

Assuming we are using ng-repeat="stuff in bunchOfStuff" is something like <a ng-click="doSomething(stuff.value)"> legal?
Yes it is legal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.