我是Angular & Firebase的新用戶。我目前正在開發一個Ionic應用程序。不知何故,我開始知道,要使用Firebase,我需要設置身份驗證系統(我更喜歡Google)。將Firebase 2.x遷移到3.4.1 AngularJS適用於Google OAuth
將代碼集成到官方Firebase網站中提到的AngularJS並不容易。因此,我只是拿起某人的工作代碼並將他的Firebase數據庫網址替換爲我的,我可以完成它。但這是一個錯誤。
這是未更改的代碼和他的輸出(按預期工作)。
的index.html
<script src="lib/angularfire/dist/angularfire.min.js"></script>
<script src="lib/firebase/firebase.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'firebase'])
.constant('FirebaseUrl', 'https://ionicle.firebaseio.com/')
.service('rootRef', ['FirebaseUrl', Firebase])
因此,首先,我刪除了他的火力地堡URL添加礦山和得到這個錯誤:
We have detected that you are using the v2.x or lower authentication SDKs with a project that was created at console.firebase.google.com. You must use the 3.0.0 or greater authentication SDKs with projects that have been created in the new console.
然後我更新firebase.js
文件到3.4.1版本。然後,我在瀏覽器的開發者控制檯中有一個引用錯誤:的ReferenceError:火力地堡沒有定義
.service('rootRef', ['FirebaseUrl', Firebase])
所以我最終需要的是谷歌的工作用的OAuth火力地堡3.x和AngularJS。
它的工作,謝謝 –
沒問題,如果它有用,請回答答案。 –