1

And I have the following links in my page as following :

<li ng-repeat="o in villes | shuffle | limitTo:5"><a href="#" ng-click="searchByVille({{o.codeVille}})">{{o.nomVille}}</a></li>

I want when I click on some link to call the searchByVille function and to log the parameter I passed to it as following :

$scope.search = function(id){
    console.log(id);
  }

which doesn't work.

How can I solve this ?

2 Answers 2

4

Omit the {{}} in your ngClick directive:

ng-click="searchByVille(o.codeVille)"

ngClick already takes an Angular expression - no need for them.

Sign up to request clarification or add additional context in comments.

Comments

0

No need to evaluate using {{}}. Use data-ng-click="searchByVille(o.codeVille)"

Comments

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.