I have

var item = { title: '', categories: []}

If i retrieve $asObject it brings categories as key/value pair. I would
like it to bring categories as $asArray.


i could sync categories.$asArray directly but i that would mean creating
two seperate firebase refs versus one.

Must i sync as seperate firebase ref, or how should i handle this?

--
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/c672a168-4fed-4bba-ae09-fde8f2d5767d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jacob Wenger at Aug 9, 2014 at 9:14 pm
    Hey there,

    You are correct in saying that if you sync an object via $asObject(), even
    deeply nested array-like object will be seen as key-value pairs instead.
    This is probably something which is not going to change since the
    complexity there is very high and will not be practical to make work. If
    you want to accomplish your goal, you will have to sync categories via
    $asArray() and the entire object via $asObject(), as you suggested.

    In this simple example, you may just want to sync categories and then use
    the $set() method on $firebase to update title. This will save you the
    memory needed to load the entire object via $asObject() and gets rid of any
    confusion from syncing categories to two different objects.

    Jacob

    On Sat, Aug 9, 2014 at 8:28 AM, supper's ready wrote:

    I have

    var item = { title: '', categories: []}

    If i retrieve $asObject it brings categories as key/value pair. I would
    like it to bring categories as $asArray.


    i could sync categories.$asArray directly but i that would mean creating
    two seperate firebase refs versus one.

    Must i sync as seperate firebase ref, or how should i handle this?

    --
    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/c672a168-4fed-4bba-ae09-fde8f2d5767d%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/c672a168-4fed-4bba-ae09-fde8f2d5767d%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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/CAKZX5-6o7v%2B2baceCSnUwpCz4Cf1KcSS6AT2d9VTZYCnJBwQSw%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedAug 9, '14 at 8:00p
activeAug 9, '14 at 9:14p
posts2
users2

2 users in discussion

Jacob Wenger: 1 post Supper's ready: 1 post

People

Translate

site design / logo © 2021 Grokbase