我得到了一個有兩個ng重複的樹狀桌子。帶參數ngClick不通過參數
<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>
對於某些功能來顯示/隱藏的「正確」線在屏幕上顯示的結果是用具有一個按鈕的每一行中調用的範圍限定的功能的樹。 在控制器I中定義的功能:
$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
}
如果我運行的頁面,樹狀構建體如預期工作,所有的按鈕被示出。如果我點擊一個按鈕,就會調用正確的函數。但是,當我檢查傳遞的參數時,它是未定義的。
有什麼我錯過了嗎?
爲什麼不用NG重複和擺脫NG-重複端行的? –
我使用開始/結束語法來使它更容易閱讀(至少對我來說),它不應該影響我認爲的參數傳遞? – Myko
無法重現[JSF上的此DEMO](https://jsfiddle.net/m3wtdsnL/)的問題。 – georgeawg