Javascript ngClick with parameter不传递参数

Javascript ngClick with parameter不传递参数,javascript,angularjs,parameters,angularjs-ng-repeat,parameter-passing,Javascript,Angularjs,Parameters,Angularjs Ng Repeat,Parameter Passing,我有一张树形的桌子,有两个ng重复 <table> <tr ng-repeat-start="am in anArray"> <td><button ng-click="TheFunction(am)"></button></td> </tr> <tr ng-repeat-start="em in anotherArray"> <td><button ng-click="TheFun

我有一张树形的桌子,有两个ng重复

<table>
<tr ng-repeat-start="am in anArray">
<td><button ng-click="TheFunction(am)"></button></td>
</tr>
<tr ng-repeat-start="em in anotherArray">
<td><button ng-click="TheFunction2(em)"></button></td>
</tr>
<tr ng-repeat-end></tr>
<tr ng-repeat-end></tr>
如果我运行页面,树状结构将按预期工作,所有按钮都将显示。如果我点击一个按钮,就会调用正确的函数。但是,当我检查传递的参数时,它是未定义的


我遗漏了什么吗?

这是你的密码。。它与
ng repeat
ng repeat start
一起工作。我用了
ng repeat
,因为它更干净

看看这是否适合您:

var-app=angular.module('app',[]);
应用控制器('main',main)
主要功能($scope){
$scope.anArray=[“a”、“b”、“c”];
$scope.anotherArray=[“狗”、“猫”、“老鼠”];
$scope.TheFunction=函数(am){
alert(am);//以及与am对象有关的其他事项
}
$scope.TheFunction2=函数(em){
alert(em);//以及与am对象有关的其他内容
}
}

{{am}}
{{em}}

为什么不使用ng repeat并去掉ng repeat end行?我使用start/end语法使其更易于阅读(至少对我而言),它不应该影响我认为传递的参数?无法重现问题。除了我没有复制到“我的”代码中的应用程序和控制器定义外,您具体更改了什么?使用了
ng repeat
而不是
ng repeat start
ng repeat end
。。您可以在代码段中看到这个简单的示例。。如果你仍然不能让它工作,请也张贴你的控制器,包括数组的一部分..嗯,我仍然不明白为什么你的代码工作,而我的不工作。使用开始-结束语法时是否存在已知错误?仅凭您提供的信息很难判断。。请提供更多信息。。例如更多的代码,我们可以更好地查看我的代码。明天我将与同事再次查看我的代码。如果我们无法找出问题的原因,我将在这里发布更多代码。谢谢
$scope.TheFunction=function(am){
alert(am); //and other things to do with the am object
}
$scope.TheFunction2=function(em){
alert(em); //and other things to do with the am object
}