The seed project returns the array


   .service('messageList', ['fbutil', function(fbutil) { return fbutil.
syncArray('messages', {limit: 10, endAt: null}); }]);


i want the array persisted in the service so i can get to the same instance
from any controller.

What is the best way to achieve this? Can we get the service example
updated for the scenario i'm describing?


--
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/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Michael Wulf at Sep 20, 2014 at 11:18 pm
    Factories and services are singletons. It should be persisted as it's not
    created on each call to messageList (it's only invoked when the service is
    initialized and the return value is returned on each call).

    To make it not a singleton, it must return a method like so;

    .factory('messageList', function(...) {
          return function() {
                return ...; // this is unique to each call to the returned
    function
          }
    });
    On Sat, Sep 20, 2014 at 11:33 AM, supper's ready wrote:

    The seed project returns the array


    .service('messageList', ['fbutil', function(fbutil) { return fbutil.
    syncArray('messages', {limit: 10, endAt: null}); }]);


    i want the array persisted in the service so i can get to the same
    instance from any controller.

    What is the best way to achieve this? Can we get the service example
    updated for the scenario i'm describing?


    --
    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/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%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%3Dr7He3fo9syzr0CX%2B6VSOwHc59H-goxesV8n5QDBzgsVQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael Wulf at Sep 20, 2014 at 11:20 pm
    That should, by the way, be using factory instead of service. I'll update
    the seed with that little detail.
    On Sat, Sep 20, 2014 at 4:18 PM, Michael Wulf wrote:

    Factories and services are singletons. It should be persisted as it's not
    created on each call to messageList (it's only invoked when the service is
    initialized and the return value is returned on each call).

    To make it not a singleton, it must return a method like so;

    .factory('messageList', function(...) {
    return function() {
    return ...; // this is unique to each call to the returned
    function
    }
    });

    On Sat, Sep 20, 2014 at 11:33 AM, supper's ready <
    johnlamontcollins@gmail.com> wrote:
    The seed project returns the array


    .service('messageList', ['fbutil', function(fbutil) { return fbutil.
    syncArray('messages', {limit: 10, endAt: null}); }]);


    i want the array persisted in the service so i can get to the same
    instance from any controller.

    What is the best way to achieve this? Can we get the service example
    updated for the scenario i'm describing?


    --
    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/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%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%3DpemT7iB%3DjLTf1_w6UktqjXxBNiGe1FEYd6opSuxaPo9w%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Supper's ready at Sep 21, 2014 at 12:31 am
    how can it invoke if authentication hasn't taken place yet (like when the
    app first starts)?

    is the firebase team working on a reference app with angularfire by chance?
    On Saturday, September 20, 2014 7:20:45 PM UTC-4, Michael Kato Wulf wrote:

    That should, by the way, be using factory instead of service. I'll update
    the seed with that little detail.

    On Sat, Sep 20, 2014 at 4:18 PM, Michael Wulf <wu...@firebase.com
    <javascript:>> wrote:
    Factories and services are singletons. It should be persisted as it's not
    created on each call to messageList (it's only invoked when the service is
    initialized and the return value is returned on each call).

    To make it not a singleton, it must return a method like so;

    .factory('messageList', function(...) {
    return function() {
    return ...; // this is unique to each call to the returned
    function
    }
    });

    On Sat, Sep 20, 2014 at 11:33 AM, supper's ready <johnlamo...@gmail.com
    <javascript:>> wrote:
    The seed project returns the array


    .service('messageList', ['fbutil', function(fbutil) { return fbutil.
    syncArray('messages', {limit: 10, endAt: null}); }]);


    i want the array persisted in the service so i can get to the same
    instance from any controller.

    What is the best way to achieve this? Can we get the service example
    updated for the scenario i'm describing?


    --
    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-angul...@googlegroups.com <javascript:>.
    To post to this group, send email to firebase...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/firebase-angular/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%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/353c003b-f531-4e14-b09e-8d7fb252c36d%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael Wulf at Sep 21, 2014 at 6:19 pm
    Look at how saving profiles works in the Auth controller
    <https://github.com/firebase/angularfire-seed/blob/master/app/js/controllers.js#L67>
    and routes.js
    <https://github.com/firebase/angularfire-seed/blob/master/app/js/routes.js#L27>.
    It utilizes routes to make sure the user is authenticated before loading
    the controller. This is preferable to trying to worry about load order and
    if/else logic around auth; just secure the paths that reference
    authenticated data.
    On Sat, Sep 20, 2014 at 4:57 PM, supper's ready wrote:

    how can it invoke if authentication hasn't taken place yet (like when the
    app first starts)?

    is the firebase team working on a reference app with angularfire by chance?
    On Saturday, September 20, 2014 7:20:45 PM UTC-4, Michael Kato Wulf wrote:

    That should, by the way, be using factory instead of service. I'll update
    the seed with that little detail.
    On Sat, Sep 20, 2014 at 4:18 PM, Michael Wulf wrote:

    Factories and services are singletons. It should be persisted as it's
    not created on each call to messageList (it's only invoked when the service
    is initialized and the return value is returned on each call).

    To make it not a singleton, it must return a method like so;

    .factory('messageList', function(...) {
    return function() {
    return ...; // this is unique to each call to the returned
    function
    }
    });

    On Sat, Sep 20, 2014 at 11:33 AM, supper's ready <johnlamo...@gmail.com>
    wrote:
    The seed project returns the array


    .service('messageList', ['fbutil', function(fbutil) { return fbutil.
    syncArray('messages', {limit: 10, endAt: null}); }]);


    i want the array persisted in the service so i can get to the same
    instance from any controller.

    What is the best way to achieve this? Can we get the service example
    updated for the scenario i'm describing?


    --
    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-angul...@googlegroups.com.
    To post to this group, send email to firebase...@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/
    msgid/firebase-angular/f3659de7-cbf9-4121-8b4b-
    0354c86fe6d5%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/f3659de7-cbf9-4121-8b4b-0354c86fe6d5%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/353c003b-f531-4e14-b09e-8d7fb252c36d%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/353c003b-f531-4e14-b09e-8d7fb252c36d%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%3DrHh1wk%3DURrVrNcQqUP2fg2TUrbsX9wOWfxa%2BrbNMguqw%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedSep 20, '14 at 9:48p
activeSep 21, '14 at 6:19p
posts5
users2

2 users in discussion

Michael Wulf: 3 posts Supper's ready: 2 posts

People

Translate

site design / logo © 2021 Grokbase