FirebaseExtended / angularfire

AngularJS bindings for Firebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$firebaseAuth No Firebase App '[DEFAULT]' has been created

JeffTCoder opened this issue · comments

Version info

**Angular: 1.5.8

**Firebase: 3.3.0

**AngularFire: 2.0.1

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

I am using the latest version of AngularFire and firebase. When i tried to use $firebaseAuth service, it gives me error

Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp().

Here is the code:

import { router } from './router';
import { MainController, InstructionController} from './controllers/main';
import {RegistrationFormController} from "./controllers/registrationform";

import * as firebase from "firebase";

var config = {
apiKey: "",
authDomain: "
",
databaseURL: "",
storageBucket: "
",
messagingSenderId: "***"
};

firebase.initializeApp(config);

var classRegApp = angular.module("classRegApp", ["ngSanitize", "ui.router", "firebase"]);

classRegApp
.config(router)
.controller("mainController", MainController)
.controller("instructionController", InstructionController)
.controller("registrationFormController", RegistrationFormController)
.controller("signInController", ["$scope", "$firebaseAuth",
function($scope, $firebaseAuth) {
$scope.auth = $firebaseAuth();

       // any time auth state changes, add the user data to scope
      $scope.auth.$onAuthStateChanged(function(firebaseUser) {
      $scope.firebaseUser = firebaseUser;
   });
 }

]);

I have tried to use $firebaseArray in the same controller and it works fine.

Please open up a new issue which properly follows the issue template (you kind of did, but it's really hard to read as is and doesn't use the proper formatting) and (most importantly) includes a repro in JSFiddle or Plunkr. If I had to guess what is wrong, you are trying to use $firebaseAuth() in a separate file or something which is called before the initializeApp() method is called. But without a smaller, debuggable repro, it's too hard to tell.

Also note that you are actually not using the latest versions of AngularFire or Firebase. As of this comment, the latest version of AngularFire is 2.1.0 and Firebase is 3.6.1.