我正在表格中打印產品列表。此產品列表具有產品類型 ( typeId)。我希望能夠typeId通過使用選擇輸入直接在表中更改產品的 。當我嘗試在選擇輸入中設置產品的默認選項時,問題就出現了,因為它應該是帶有typeId.ng-repeat="x in screensList". x 代表產品。我嘗試使用 ng-init 或 ng-value,但它不起作用。每個選擇的 ng-model 應該是什么值?代碼和圖片:<tbody> <tr ng-repeat="x in screensList"> <th scope="row"> {{x.pantalla}} </th> <td> {{x.description}} </td> <td> <select class="form-control" ng-model="slideshowSelect" ng-options="y.title for y in slideshowsList track by y.id"> </select> </td> <td class="text-right"> <button type="button" ng-click="deleteService($event)" serviceId="{{x.id}}" class="btn btn-danger btn-sm">Eliminar</button> </td> </tr></tbody>彩色代碼:結果:
ng-repeat中的AngularJS動態選擇
九州編程
2021-07-02 09:07:54