我正在應用'orderby'過濾器,但它不起作用。我從API獲取數據,我仔細檢查,肯定會來。但過濾器不起作用。爲什麼orderby過濾器不工作?
<div class="filter-container">
<select class="form-control" ng-model="userOrder">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</div>
<tr class="odd" ng-repeat="user in allusers | filter: query1 | filter: query2 | filter: query3 | filter: query4 | filter: query5 | orderBy: userOrder">
<td>
<span ng-if="user.superuser==1">Yes</span>
<span ng-if="user.superuser==0">No</span>
</td>
<td>
<span ng-if="user.status==0">Not active</span>
<span ng-if="user.status==1">Active</span>
<span ng-if="user.status==-1">Banned</span>
</td>
</tr>
我的控制器:
$scope.user = function() {
$http.get('http://event/users/users/')
.success(function (data) {
$scope.allusers = data;
console.log("all users data coming in user function");
})
.error(function (data) {
console.log('error');
});
};
他已經在'$ scope.allusers = data;'中添加數據;' –
我在另一個項目中編寫了相同的代碼,它在那裏工作,但不在這裏, –
@UsmanIqbal can you pl輕鬆寫入$ scope.allusers中的虛擬數據是什麼? – Mitul