[英]How I pass an object as a parameter in a ng-click within a ng-repeat? AngularJS
我如何在 ng-repeat 中的 ng-click 中将对象作为参数传递?
例子:
<tr data-ng-repeat="table in tables">
<td>{{ table.name }}</td>
<td>{{ isActive(table.active) }}</td>
<td>{{ table.initialDate }}</td>
<td>{{ table.finalDate }}</td>
<td>
<button data-ng-click="updateTable(table)">Update</button>
</td>
</tr>
在 ng-click updateTable( HERE ) 中,我想传递我的对象表。
有人能帮我吗?
在您的 component.html 中编辑您的代码,如下所示:
<td><button (click)=updateTable(table)>Update</button></td></tr>
然后在你的打字稿代码中声明函数
updateTable(table){
console.log(table); //write your own code here!.
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.