新 Firebase 中的 Firebase angularfire [英] Firebase angularfire in new firebase
问题描述
我有一个 angular 应用程序,它利用了 angularFire 库.firebase 文档中声明支持 angularfire https://firebase.google.com/support/guides/firebase-web#update_your_firebase_libraries_numbered
I have an angular app, which utilizes the angularFire library. It is stated in the firebase documentation that angularfire is supported https://firebase.google.com/support/guides/firebase-web#update_your_firebase_libraries_numbered
我已将 firebase 和 angularfire 更新到最新版本.
I have updated firebase and angularfire to the latest version.
之前://这有效:-)
BEFORE: //This works :-)
// *** DataService ***
var root = new Firebase(FIREBASE_URL);
var service = {
root: root,
items: root.child('items'),
tastings: root.child('tastings'),
users: root.child('users'),
votes: root.child('votes')
};
return service;
// *** Controller ***
$scope.tastings = $firebaseArray(dataService.tastings);
AFTER://这不起作用:-(
AFTER: //This does not work :-(
// *** app.js ***
.run(function (FIREBASE_CONFIG) {
firebase.initializeApp(FIREBASE_CONFIG);
});
// *** DataService ***
var root = firebase.database().ref();
var service = {
root: root,
items: root.child('items'),
tastings: root.child('tastings'),
users: root.child('users'),
votes: root.child('votes')
};
return service;
// *** Controller ***
$scope.tastings = $firebaseArray(dataService.tastings);
我收到的错误:必须将有效的 Firebase 引用传递给 $firebase(不是字符串或 URL)"
The error I am getting: "Must pass a valid Firebase reference to $firebase (not a string or URL)"
当我评估 dataService.tastings 时,它看起来像 chrome 控制台中的 firebase 引用,尽管有新的属性,如已添加的数据库.
It looks like a firebase reference in chrome console when i evaluate dataService.tastings, though there are new properties like database, which has been added.
推荐答案
AngularFire 现已正式更新以支持 Firebase 3.x.x :)
AngularFire is now officially updated to support Firebase 3.x.x :)
这篇关于新 Firebase 中的 Firebase angularfire的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!