我的Firebase用户节点中有10个用户,他们是
我有一个代码,列出了我的用户列表中的所有用户,代码:
service.js:
app.service("ListAllUserService",function($q, $rootScope, $ionicPopup, $firebaseAuth, $firebaseObject, $firebaseArray, $localStorage, $ionicLoading){
var self ={
'data' : '',
'Loading': true,
"hasMore":true,
"page":10,
"next_page":3,
'users' : '',
'lastKnownDomainValue': [],
'ListUser': function(){
var deferred = $q.defer();
var usersRef = new Firebase("https://bigzill.firebaseio.com/users");
var usersRef2 = new Firebase("https://bigzill.firebaseio.com");
var authData = usersRef.getAuth();
$rootScope.scrollRef = new Firebase.util.Scroll(usersRef,"username");
if(authData){
self.users = $firebaseArray($rootScope.scrollRef);
$rootScope.scrollRef.scroll.next(self.page);
self.Loading =false;
deferred.resolve(self.users);
}else{
console.log("User not Authenticated");
deferred.reject(data);
}
return deferred.promise;
}
}
self.ListUser();
return self;
});
controller.js:
app.controller('ListAllUserCtrl', function($scope, $rootScope, $state, $ionicPopup, $firebaseAuth, $firebaseObject, $firebaseArray, PresenceService, $localStorage, $ionicLoading, ListAllUserService){
$scope.Get =ListAllUserService;
$scope.LoadAllUser =function(){
$ionicLoading.show({template:'Loading...'});
$scope.Get.ListUser().then(function(data){
$scope.users =data;
console.log($scope.users);
$ionicLoading.hide();
});
}
$scope.LoadAllUser();
});
我想确保返回结果中不显示登录用户。
您看到zionnite已不在列表中。