firebase+ angular orderby 查询不工作
firebase+ angular orderby query not working
我在使用 firebase 执行此查询时遇到此错误,这不是错误,但它没有返回任何内容。
这是工厂
.factory("items", function($firebaseArray) {
var itemsRef = new Firebase("https//*****.firebaseio.com/comments");
return $firebaseArray(itemsRef);
})
在我的控制器中,这是调用 .using the orderby property/attribute
的方式
.controller('tdCtrl', function($scope, FeedList, $firebaseArray, $firebase,
$stateParams, dataStore, feedSources, $ionicModal, items) {
$scope.items=items //working when am calling normally
但现在我想用散列键 3432 获取所有评论——它是动态的,但用作 3432 以便于解释
$scope.items = items.orderByChild("hashKey").equalTo(3434).on("child_added",
function(snapshot) {
});
这是post函数
.........
$scope.comment.hashkey=3432;
$scope.items.$add(comment);
.............
已解决 - 在尝试使用 firebase 之前,请先阅读所有文档,大多数博客教程使用大量已弃用的代码,因此请先阅读文档 :)
var fireRef= new Firebase("https//****.firebaseio.com/comments");
$scope.items = $firebaseArray(fireRef.orderByChild("hashKey").equalTo(id).limitToLast(10));
我在使用 firebase 执行此查询时遇到此错误,这不是错误,但它没有返回任何内容。
这是工厂
.factory("items", function($firebaseArray) {
var itemsRef = new Firebase("https//*****.firebaseio.com/comments");
return $firebaseArray(itemsRef);
})
在我的控制器中,这是调用 .using the orderby property/attribute
的方式.controller('tdCtrl', function($scope, FeedList, $firebaseArray, $firebase,
$stateParams, dataStore, feedSources, $ionicModal, items) {
$scope.items=items //working when am calling normally
但现在我想用散列键 3432 获取所有评论——它是动态的,但用作 3432 以便于解释
$scope.items = items.orderByChild("hashKey").equalTo(3434).on("child_added",
function(snapshot) {
});
这是post函数
.........
$scope.comment.hashkey=3432;
$scope.items.$add(comment);
.............
已解决 - 在尝试使用 firebase 之前,请先阅读所有文档,大多数博客教程使用大量已弃用的代码,因此请先阅读文档 :)
var fireRef= new Firebase("https//****.firebaseio.com/comments");
$scope.items = $firebaseArray(fireRef.orderByChild("hashKey").equalTo(id).limitToLast(10));