Hi!

I have two questions about best practice with AngularFire 0.8.

I have an array of objects stored within Firebase, each of which is quite
complex (denormalized as
per https://www.firebase.com/blog/2013-04-12-denormalizing-is-normal.html).
When these objects come from the database, I have to perform some
calculations and store results in those objects, and I don't want those to
be synced back, I need them to be computed anew each time the object is
updated. How can I store those values so that they aren't uploaded to
Firebase? I tried properties starting with $, but AngularFire complains
about them when saving. Prefixing with an underscore would make it not save
them (according to the docs) but will recursively call my watch callback!
Is there any way out of this?

The second question is about data binding. Can I use $bindTo() on complex
data structures like that? The docs warn against this. Is there any other
way I can get updates from Firebase if anything has changed deep inside one
of the objects?

Thanks,
Alex

--
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/c805d30d-9679-481c-becb-321c8b34cd88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Michael Wulf at Aug 5, 2014 at 12:57 am
    To transform your data, use the $extendFactory methods as described here.
    <https://www.firebase.com/docs/web/bindings/angular/guide.html#section-extending-factories>
    By adding a toJSON method onto the objects, you can control which specific
    fields are saved back to Firebase. If you want specific answers to your
    questions about why $ variables are conflicting or how to resolve a
    specific use case, please distill your question to a specific scenario that
    we can address, and provide a simple code sample that reproduces the issues
    you're running into.

    Regarding data binding, you don't want to use this on collection or deeply
    nested objects. Both the synchronized object and array have a $watch
    method. However, you probably shouldn't be using this for nearly any use
    cases (there are a couple exceptional cases like sorting). If you find that
    you're trying to recreate firebase's events, then you aren't looking for
    data bindings and data transformation, so just drop down to the SDK level
    and work from there.

    On Sat, Aug 2, 2014 at 1:24 PM, Alex Shnitman wrote:

    Hi!

    I have two questions about best practice with AngularFire 0.8.

    I have an array of objects stored within Firebase, each of which is quite
    complex (denormalized as per
    https://www.firebase.com/blog/2013-04-12-denormalizing-is-normal.html).
    When these objects come from the database, I have to perform some
    calculations and store results in those objects, and I don't want those to
    be synced back, I need them to be computed anew each time the object is
    updated. How can I store those values so that they aren't uploaded to
    Firebase? I tried properties starting with $, but AngularFire complains
    about them when saving. Prefixing with an underscore would make it not save
    them (according to the docs) but will recursively call my watch callback!
    Is there any way out of this?

    The second question is about data binding. Can I use $bindTo() on complex
    data structures like that? The docs warn against this. Is there any other
    way I can get updates from Firebase if anything has changed deep inside one
    of the objects?

    Thanks,
    Alex

    --
    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/c805d30d-9679-481c-becb-321c8b34cd88%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/c805d30d-9679-481c-becb-321c8b34cd88%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/CAFHX4%3Do0TUUfJGZCn5%2B6GjWzMDgn4Dr57zvcvYC7USiLoVWezA%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedAug 5, '14 at 12:24a
activeAug 5, '14 at 12:57a
posts2
users2

2 users in discussion

Alex Shnitman: 1 post Michael Wulf: 1 post

People

Translate

site design / logo © 2021 Grokbase