How to define Firebase?

288 views Asked by At

Im trying to learn Angular and the video tutorial I am doing is using Firebase, Ive got Firebase defined as

//Contacts controller
.controller('ContactsCtrl', ['$scope', '$firebaseArray', function($scope, $firebaseArray) {
  //init firebase
  var ref = new Firebase('https://myappurl-048596.firebaseio.com/');

but when viewing the console, I keep getting errors saying Firebase not defined and it breaks the whole project. So, how do I properly define Firebase so that I can get rid of this error?

1

There are 1 answers

0
ziaulain On
  1. Follow this link: https://firebase.google.com/docs/web/setup

  2. Add this in your config function:

    var firebaseConfig = {
        apiKey: "<API_KEY>",
        authDomain: "<PROJECT_ID>.firebaseapp.com",
        databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
        storageBucket: "<BUCKET>.appspot.com",
        messagingSenderId: "<SENDER_ID>",
    };
    
    firebase.initializeApp(firebaseConfig);