Tutorialsplane

AngularJs pass value to ng-click function


AngularJs pass value to ng-click function inside ng-repeat – We sometimes need to pass parameters to ng-click inside the ng-repeat. It is very simple to pass variables to the ng-click function. Here in this tutorial we are going to explain how you can parameters to the ng-click function. You can use our online editor to edit and run the code online.


AngularJs pass value to ng-click function inside ng-repeat

You can pass the values to the ng-click functions simply as below-

AngularJs pass value to ng-click function inside ng-repeat




 
 

  
<div ng-app="myApp">  
<div ng-controller="myController">
<span class="amp-wp-inline-01f5cfbe2bd48c48141436de8759023a">{{message}}</span> 
<table>
<tr><th>Id</th><th>Name</th></tr>
<tr ng-repeat="content in rows">
      <td>{{content.id}}</td> <td>{{content.name}}</td>
	  <td><a href="#" ng-click="removeRow($index, content.id)">Remove</a></td>
</tr>
</table>

</div> 
</div>
  
 

Try it »

Now everything is ready just run the above example to see the demo. If you run the above example it will produce the output something like this –