Reputation: 2074
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 ?
Upvotes: 1
Views: 2066
Reputation: 109
No need to evaluate using {{}}.
Use data-ng-click="searchByVille(o.codeVille)"
Upvotes: 0
Reputation: 104775
Omit the {{}}
in your ngClick
directive:
ng-click="searchByVille(o.codeVille)"
ngClick
already takes an Angular expression - no need for them.
Upvotes: 4