嗨,這個表格顯示角JS。用ng-repeat顯示包含ng-repeat的表格
<div class="table-responsive ">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Nom</th>
<th>Prénom</th>
<th>login</th>
<th>email</th>
<th>group</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in allusers ">
<td>{{ user.lastname}}</td>
<td>{{ user.firstname}}</td>
<td>{{ user.login}}</td>
<td>{{ user.email }}</td>
<td>
<select class="form-group"
ng-click="getAllGroupsofUser(user.id)">
<option ng-repeat="group in groupsofuser">{{group.name}}</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
我使用的是AngularJS的REST風格的Web服務。當我點擊select(在列組中的特定用戶行中)時,我得到正確的列表,但問題是所有列組都會更改,並且具有相同的選擇選項。
我該如何解決這個問題?
你的用戶對象是什麼樣的?應該是'group in user.groupsofuser'? – tymeJV
這很好...你正在迭代的數組看起來像什麼?您可以發佈從服務中收到的數據樣本嗎? – tymeJV
問題是'user'的所有行共享相同的$ scope.groupsofuser。 – yazaki