javascript函数无法识别传递给它的角度变量
我正在尝试使用ng repeat to javascript函数传递3个参数,但我不知道如何传递。我试着这样做:javascript函数无法识别传递给它的角度变量,javascript,angularjs,Javascript,Angularjs,我正在尝试使用ng repeat to javascript函数传递3个参数,但我不知道如何传递。我试着这样做: <tbody ng-repeat="(user_id, row) in data"> <tr ng-repeat="(script_id, cron_format) in row "> <td ng-model="user_name">{{user(user_id)}}&l
<tbody ng-repeat="(user_id, row) in data">
<tr ng-repeat="(script_id, cron_format) in row ">
<td ng-model="user_name">{{user(user_id)}}</td>
<td ng-model="script_name">{{script(script_id)}}</td>
<td ng-model="cron_format"><span ng-repeat="l in letters(cron_format) track by $index">{{l}}</span><button class="save" onclick="saveCron(user_id,script_id,cron_format)">save</button></td>
</tr>
</tbody>
{{user(user_id)}
{{script(script_id)}
{{l}}保存
但是它不起作用。有人能解释一下为什么吗?上面的代码不起作用,因为您使用了错误的语法 javascript函数不应在花括号内调用,否则应直接调用。就像您在代码第5行中调用了另一个JS函数,如下所示:
onclick = "anyFunction()"
对于角度单击事件,应使用ng click,以便:-
<td ng-model="cron_format"><span ng-repeat="l in letters(cron_format) track by $index">{{l}}</span><button class="save" ng-click="saveCron(user_id,script_id,cron_format)">save</button></td>
</tr>
{{l}保存
将帮助您解决问题。如果您正在呼叫angular clock Event,则单击onclick应为ng click。太棒了,它工作正常……谢谢!