firebase-util / ionic / normalizedCollection issue..

62 views
Skip to first unread message

Steven Hastie

unread,
Mar 25, 2016, 5:25:36 AM3/25/16
to Firebase Google Group
Hey, 

I was hoping someone could help me with this issue i'm having.

I'm using a bunch of normalizedCollections in my ionic app. The issue i'm having is if, for whatever reason, changing between views triggers a controller to reload it will get stuck loading because the noralizedCollection in the controller cannot seem to reload if it has already been loaded previously. 

It just gets stuck. It doesn't return any message to the console. Nothing. Just refuses to load.

Any ideas?


Any help would be greatly appreciated. 

Kato Richardson

unread,
Mar 25, 2016, 12:12:45 PM3/25/16
to Firebase Google Group
Steven,

A nuanced problem like this is going to require a minimal, complete, verifiable, example for us to be any help. Try creating a fiddle or plunker.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/d5af2376-6613-4fa4-9a6e-bc1e7763307d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Steven Hastie

unread,
Mar 26, 2016, 10:20:46 PM3/26/16
to Firebase Google Group

I have this in my controller:

        var information= getinformation();

        information.$loaded()
        .then(function (x) {

            // ***
            $scope.info = information;

        })


and this is my factory: 

    return function (uid) {
        var ref = new Firebase(FURL);
        var sessionArray = new Firebase.util.NormalizedCollection(
        [ref.child("childName").orderByChild("child").equalTo("something"), "something"],
        [ref.child("childName").limitToFirst(20), "anotherthing", "something.name"]
        ).select(
            "something.name",
            "something.city",
            "something.country",
            "anotherthing.message"
        ).ref();

        var sessionInfo = $firebaseArray(sessionArray);
        return sessionInfo;
    }


Any time a controller tries to load for a second time... for example if I have the state cache set to false or the state resets. It will just stall and get stuck trying to load the collection for a second time. 

Hope this helps.


Thanks

Steven Hastie

unread,
Mar 26, 2016, 10:20:54 PM3/26/16
to Firebase Google Group
Scratch that.... I realised $loaded can only be used once and that's what is causing the issue. Now to figure out how to solve this issue. 

Kato Richardson

unread,
Mar 28, 2016, 1:50:32 PM3/28/16
to Firebase Google Group
There's no reason in this (very terse and minimal) line of code you've provided to use $loaded. Just $scope.information = getInformation() should work fine. If you provide a repro, we can be more helpful.


For more options, visit https://groups.google.com/d/optout.

Steven Hastie

unread,
Apr 27, 2016, 10:56:07 PM4/27/16
to Firebase Google Group
The reason I am using $loaded is to prevent the loader from disappearing before the data has been loaded. Is there a better way to display the loader until the data has been retrieved from firebase?
Reply all
Reply to author
Forward
0 new messages