[英]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.