錯了鑰匙我都有數據:angularJS直放站
[Object, Object, Object]
0: Object
$$hashKey: "007"
amount: "123111"
name: "test"
number: "5"
position: "ttt"
1: Object
$$hashKey: "006"
amount: "123111"
name: "test4"
number: "4"
position: "поз"
2: Object
$$hashKey: "005"
amount: "34555"
name: "еее"
number: "1"
position: "вапвап"
,我在HTML中有中繼器:
<tr ng-repeat="(key, player) in players | orderBy:'number'">
<td>{{key}} - {{player.number}}</td>
<td>{{player.name}}</td>
<td>{{player.position}}</td>
<td>{{player.amount}}</td>
<td>
<button ng-click="edit(key)" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span></button>
<button ng-click="delete(key)" class="btn btn-danger"><span class="glyphicon glyphicon-floppy-remove"></span></button>
</td>
</tr>
我需要從中繼當前元素的數據拿到鑰匙,但關鍵是我得到了訂單的價值。
0 - 1 еее вапвап 34555
1 - 4 test4 поз 123111
2 - 5 test ttt 123111
,但我需要:
2 - 1 еее вапвап 34555
1 - 4 test4 поз 123111
0 - 5 test ttt 123111
凡'key'哪裏來的?它沒有在對象結構中定義。 –
爲什麼不只是編輯(播放器)? – vittore
謝謝! '編輯(播放器)'對我來說太好了 – user1005180