Please, help me with Object list in Firebase javascript Api.

More details:

http://stackoverflow.com/questions/32277232/firebase-retrieve-object-list-in-firebase-javascript-api


I have a data Object this way:

[image: screenshot firebase] <http://i.stack.imgur.com/xzzrG.png>

.factory('Rooms', function ($firebaseObject, Objects) {
        var ref = new Firebase(firebaseUrl);
        var rooms = $firebaseObject(ref.child('rooms'));

        return {
            all: function () {
                return rooms;
            },
            get: function (roomId) {
                // Simple index lookup

                console.log('ROOMS:', rooms);
                console.log('ROOM specified:', ref.child(roomId).key());

                return rooms[ref.child(roomId)];
            },

I have a data object in this way and would like to return a list containing 
the keys and also return a specifically agreed.

Object {params: Object, current: Object, $current: extend, transition: 
null}$current: extendcurrent: Objectget: (stateOrName, context)go: go(to, 
params, options)href: href(stateOrName, params, options)includes: 
includes(stateOrName, params, options)is: is(stateOrName, params, 
options)params: Objectreload: reload()transition: nulltransitionTo: 
transitionTo(to, toParams, options)__proto__: Object
services.js:87 Selecting the room with id: -JxpHcEz2I5j3wDlpbpq
services.js:29 ROOMS: d {$$conf: Object, $id: "rooms", $priority: null}$$conf: 
Object$id: "rooms"$priority: null-JxpHcEz2I5j3wDlpbpq: 
Object-JxpHcFb-nzJNsYe_cAb: Object__proto__: Object
services.js:30 ROOM specified: -JxpHcEz2I5j3wDlpbpq

var rooms = Rooms.all(); console.log('Lenght:', rooms.lenght); 

output: Length: undefined

I did not want to create factories in Angular to treat data that own 
Firebase could bring properly for me.

.factory('Objects', function () {
        return {
            filter: function (objectValues, objectKey) {
                // to take an action after the data loads, use the $loaded() 
promise
                objectValues.$loaded().then(function () {
                    // To iterate the key/value pairs of the object, use 
angular.forEach()
                    angular.forEach(objectValues, function (value, key) {
                        console.log(objectValues[objectKey]);
                    });
                });
            }
        }
    })

How can I treat the items of Firebase with AngularJs?



And more details:


http://stackoverflow.com/questions/32279103/firebase-snapshot-list-undefined/32281350#32281350




-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to