我正在从下面调用一个函数:-
<a href="#" ng-click="editExpense('{{expense.Expense.id}}')">Edit</a>
在检查元素中,我得到的 id 是“12”。但在下面的函数中:-
$scope.editExpense = function(id){
alert(id);
}
Id显示“expense.Expense.id”。那么我如何传递参数。有没有其他方法可以使用 Angular js 变量值调用函数。
最佳答案
您不需要在 ngDirective 中使用大括号。
<a href="#" ng-click="editExpense(expense.Expense.id)">Edit</a>
关于javascript - 使用其参数调用 Angular js 中的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23170373/