Skip to content
This repository was archived by the owner on Aug 25, 2018. It is now read-only.
This repository was archived by the owner on Aug 25, 2018. It is now read-only.

ReferenceError: Firebase is not defined line 153 in backbonefire.js #160

@Bart-Holland

Description

@Bart-Holland

Hi I am trying to run this model:

var APP = APP || {};

APP.FBLocationsModel = Backbone.Firebase.Model.extend({

    urlRoot: APP.fireBase.config.databaseURL + 'users/',
    autoSync: true,

    initialize: function () {

        this.listenToOnce(this, 'FBInit', this.setUrl);
        this.connectWithFirebase();

    },

    setUrl: function () {

        this.url = this.urlRoot + FB.uid + "/locations/";

    },

    connectWithFirebase: function () {

        var that = this;

        //check if firebase config is there
        if (APP.fireBase.config) {
            FB.config = APP.fireBase.config;
        } else {
            throw("Need firebase config object");
        }

        //initialize -> auth -> login
        FB.init(function () {
            that.trigger('FBInit')
        });

    }
});

and in the code I do this:

APP.fbLocationsModel = new APP.FBLocationsModel();
APP.fbLocationsModel.fetch();

After doing so I get this error in my console:
ReferenceError: Firebase is not defined line 153 in backbonefire.js

Firebase itself is loaded (version 3.6.10)
looking in the code ofr backbonefire.js I see this code:

Backbone.Firebase._determineRef = function(objOrString) {
        switch (typeof(objOrString)) {
            case 'string':
                return new Firebase(objOrString);
            case 'object':
                return objOrString;
            default:
                Backbone.Firebase._throwError('Invalid type passed to url property');
        }
    };

In the case 'string' I is where it says: 'Firebase is not defined' but can't figure out why.
I do use require, maybe that is an issue here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions