I wanted to implement "Querying Data with firebase" whose documentation was given at fallowing link: " https://www.firebase.com/docs/web/guide/retrieving-data.html ". I started implementing the code as following:
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");
})
},
But, I was unable to get the result, in fact an error was produced:
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)
Kindly guide me, how can I use these "Querying Data with firebase" functions like "Ordering by a specified child key", Ordering by key name, Ordering by value, Ordering by priority etc.
My project's firebase version is : firebase: 2.1.X
Please help...
Thanks
I don't see any problem, see my codepen
Did you include:
<script src="https://cdn.firebase.com/js/client/2.1.1/firebase.js"></script>
[Edited no more relevant] As specified in https://www.firebase.com/docs/rest/quickstart.html any Firebase URL as a REST endpoint by appending .json to the end of the URL :
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs.json");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.