Hello! Angular newbie here..

I am working on my first Angular app, using Firebase to persist my data.
Here is the source on Github <https://github.com/dermatobia/ng-stickies>,
and if you want to play around the live app on Firebase, here is the url:
https://ng-stickies.firebaseapp.com/

As you can see on the app, I am having issues syncing my note's position. I
believe I am passing a 3-way binded element to ng-draggable directive, and
it syncs on the first move, but subsequent note moves aren't syncing,
unless I click onto another board. Any insight what went wrong?

Also, since this is my first app, any input / feedback are welcome!

I really would like to clean up my controller and organize it into other
services, but I haven't quite figured out how to break it down yet. Should
I go with factory or service? Should note and modals be on separate
controller or service?

--
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/7255a8f5-ecc1-4e91-89d4-6dbbb480a6d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Michael Wulf at Oct 7, 2014 at 6:26 pm
    Hello!

    The first issue I see here is that the same content has been bound to and
    synchronized multiple times. Examples:

    $firebase(ref.child('boards')).$asObject().$bindTo($scope, 'boards');
    $scope.boardsArr = $firebase(ref.child('boards')).$asArray();
    $firebase(ref.child('boards/' + ... +
    '/notes')).$asObject().$bindTo($scope, 'notes');
    $firebase(ref.child('boards/' + ... + '/notes')).$asArray();

    All of these bind to the exact same data (possibly many times per board
    id). This is unnecessary and likely to cause race conditions when those
    instances start competing to be the authoritative voice.

    Pick one: Either bind them using $asArray() and call $save() after making
    changes (which is probably what you want) or use $asObject() and $bindTo().
    But not both. And certainly don't bind to the same data twice if you can
    help it.

    The second issue I see here is that we're probably downloading way more
    data than we need. Essentially, we grab all boards, all notes, and all data
    contained under those to list boards and show notes for a single board.
    Check out the docs on structuring data
    <https://www.firebase.com/docs/web/guide/structuring-data.html> for some
    ideas here. I'd start by moving notes to their own path, referenced by
    board id.

    This will also help with the first problem since you can synchronize the
    notes for a board separately.

    Cheers,
    Kato

    On Sat, Oct 4, 2014 at 10:28 PM, webble webble wrote:

    Hello! Angular newbie here..

    I am working on my first Angular app, using Firebase to persist my data.
    Here is the source on Github <https://github.com/dermatobia/ng-stickies>,
    and if you want to play around the live app on Firebase, here is the url:
    https://ng-stickies.firebaseapp.com/

    As you can see on the app, I am having issues syncing my note's position.
    I believe I am passing a 3-way binded element to ng-draggable directive,
    and it syncs on the first move, but subsequent note moves aren't syncing,
    unless I click onto another board. Any insight what went wrong?

    Also, since this is my first app, any input / feedback are welcome!

    I really would like to clean up my controller and organize it into other
    services, but I haven't quite figured out how to break it down yet. Should
    I go with factory or service? Should note and modals be on separate
    controller or service?

    --
    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/7255a8f5-ecc1-4e91-89d4-6dbbb480a6d6%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/7255a8f5-ecc1-4e91-89d4-6dbbb480a6d6%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%3DoYM1_gXu7wjY6pJ9KnwQHA58SD2jgiQVymYLTNWWV_BA%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedOct 6, '14 at 3:56p
activeOct 7, '14 at 6:26p
posts2
users2

2 users in discussion

Michael Wulf: 1 post Webble webble: 1 post

People

Translate

site design / logo © 2021 Grokbase