I'm retrieving data like this:

var URL="https://somethingblabla.firebaseio.com/";
var ref= new Firebase(URL);
var data = $firebase(ref).$asArray();

data.$loaded().then(function(data){
       //some code
        LocalStorageService.setContacts(data.$getRecord('contacts')); //this
works
        LocalStorageService.setContacts(data.$getRecord('names')); //works
        LocalStorageService.setContacts(data.$getRecord('events').$getRecord('day1));
/don't work, other solutions?
});

I have keys 'contacts', 'names' for them that work, I get records...
But I have key 'events' and in events are some other keys like 'day1','day2'
, etc. How to get records from day1, day2?

-contacts
     --0 -value
     --1 -value
-names
     --0 -value
     --1 -value
-events
     --day1
          --- 0 -value
          --- 1 -value
     --day2
          --- 0 -value
          --- 1 -value








--
You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
To post to this group, send email to firebase-angular@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/81711655-caef-4893-a2eb-0f84aa7b44fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jacob Wenger at Jan 4, 2015 at 8:43 pm
    Hey Matija,

    Using $asArray() with deeply nested structures like your /events/ node is
    not suggested. If you think about it, you are trying to coerce a JavaScript
    object (with unordered keys) into a JavaScript array (with ordered
    indices). As you might guess, this doesn't always work out really well. I
    would also imagine that you'd rarely want to load your entire /events/ node
    into memory at the same time. You would probably be better off using
    $asArray() on one of the children nodes (e.g. /events/day1/ or /events/day2/)
    or using $asObject() on the main /events/ node.

    Jacob
    On Friday, January 2, 2015 10:51:04 AM UTC-5, Matija Kovaček wrote:

    I'm retrieving data like this:

    var URL="https://somethingblabla.firebaseio.com/";
    var ref= new Firebase(URL);
    var data = $firebase(ref).$asArray();

    data.$loaded().then(function(data){
    //some code
    LocalStorageService.setContacts(data.$getRecord('contacts')); //this
    works
    LocalStorageService.setContacts(data.$getRecord('names'));
    //works
    LocalStorageService.setContacts(data.$getRecord('events').
    $getRecord('day1)); /don't work, other solutions?
    });

    I have keys 'contacts', 'names' for them that work, I get records...
    But I have key 'events' and in events are some other keys like 'day1',
    'day2', etc. How to get records from day1, day2?

    -contacts
    --0 -value
    --1 -value
    -names
    --0 -value
    --1 -value
    -events
    --day1
    --- 0 -value
    --- 1 -value
    --day2
    --- 0 -value
    --- 1 -value






    --
    You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/918751a1-f22d-4e00-b986-5c799cc33c44%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedJan 4, '15 at 8:25p
activeJan 4, '15 at 8:43p
posts2
users2

2 users in discussion

Jacob Wenger: 1 post Matija Kovaček: 1 post

People

Translate

site design / logo © 2021 Grokbase