ng-选择ng-repeat不能用于复杂的代码

时间:2015-12-03 12:02:30

标签: angularjs

HTML:

<div ng-repeat="gridRow in gridData" class="row">
    <select ng-options="room as room.OpRoomName for room in RoomNameList track by room.OpRoomId" ng-model="gridRow.RoomId"></select>
    {{gridRow.RoomId}}
</div>

数据:

 gridData = [{
     A: 2,
     B: 3,
     RoomId: 1
 }, {
     A: 2,
     B: 3,
     RoomId: 3
 }, {
     A: 2,
     B: 3,
     RoomId: 5
 }]

 RoomNameList = [{
     OpRoomName: "A",
     OpRoomId: 1
 }, {
     OpRoomName: "B",
     OpRoomId: 2
 }, {
     OpRoomName: "C",
     OpRoomId: 4
 }, {
     OpRoomName: "D",
     OpRoomId: 3
 }, ]

无法设置所选选项

0 个答案:

没有答案