orderByChild()、limitTo() 在我的 angularjs 项目中不起作用。?
orderByChild(), limitTo() not working in my angularjs project.?
我想实现 "Querying Data with firebase",其文档在休假时给出 link:“https://www.firebase.com/docs/web/guide/retrieving-data.html”。我开始执行如下代码:
getDetail : function() {
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs");
ref.orderByChild("height").on("child_added", function(snapshot) {
console.log(snapshot.key() + " was " + snapshot.val().height + " meters tall");
})
},
但是,我无法得到结果,实际上产生了一个错误:
TypeError: ref.orderByChild is not a function
at Object.history.getDetail (history.js:20)
at Scope.$scope.getDetail (history.js:11)
at $parseFunctionCall (angular.js:12332)
at angular-touch.js:472
at Scope.$get.Scope.$eval (angular.js:14383)
at Scope.$get.Scope.$apply (angular.js:14482)
at HTMLButtonElement.<anonymous> (angular-touch.js:471)
at HTMLButtonElement.jQuery.event.dispatch (jquery.js:4430)
at HTMLButtonElement.jQuery.event.add.elemData.handle (jquery.js:4116)
请指导我,如何使用这些 "Querying Data with firebase" 函数,如 "Ordering by a specified child key",按键名排序,按值排序, 按优先级排序 等等
我项目的 firebase 版本是:firebase: 2.1.X
请帮忙...
谢谢
我没有发现任何问题,请查看我的 codepen
你有没有包括:
<script src="https://cdn.firebase.com/js/client/2.1.1/firebase.js"></script>
[已编辑不再相关]
如 https://www.firebase.com/docs/rest/quickstart.html 中指定的任何 Firebase URL 作为 REST 端点,通过将 .json 附加到 URL 的末尾:
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs.json");
我想实现 "Querying Data with firebase",其文档在休假时给出 link:“https://www.firebase.com/docs/web/guide/retrieving-data.html”。我开始执行如下代码:
getDetail : function() {
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs");
ref.orderByChild("height").on("child_added", function(snapshot) {
console.log(snapshot.key() + " was " + snapshot.val().height + " meters tall");
})
},
但是,我无法得到结果,实际上产生了一个错误:
TypeError: ref.orderByChild is not a function
at Object.history.getDetail (history.js:20)
at Scope.$scope.getDetail (history.js:11)
at $parseFunctionCall (angular.js:12332)
at angular-touch.js:472
at Scope.$get.Scope.$eval (angular.js:14383)
at Scope.$get.Scope.$apply (angular.js:14482)
at HTMLButtonElement.<anonymous> (angular-touch.js:471)
at HTMLButtonElement.jQuery.event.dispatch (jquery.js:4430)
at HTMLButtonElement.jQuery.event.add.elemData.handle (jquery.js:4116)
请指导我,如何使用这些 "Querying Data with firebase" 函数,如 "Ordering by a specified child key",按键名排序,按值排序, 按优先级排序 等等
我项目的 firebase 版本是:firebase: 2.1.X
请帮忙...
谢谢
我没有发现任何问题,请查看我的 codepen
你有没有包括:
<script src="https://cdn.firebase.com/js/client/2.1.1/firebase.js"></script>
[已编辑不再相关] 如 https://www.firebase.com/docs/rest/quickstart.html 中指定的任何 Firebase URL 作为 REST 端点,通过将 .json 附加到 URL 的末尾:
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs.json");