简体   繁体   中英

How to define Firebase?

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. 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); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM