我有一个角度应用程序,它利用 angularFire 库。 firebase文档中指出支持angularfirehttps://firebase.google.com/support/guides/firebase-web#update_your_firebase_libraries_numbered https://firebase.google.com/support/guides/firebase-web#update_your_firebase_libraries_numbered
我已将 firebase 和 angularfire 更新到最新版本。
之前://这有效:-)
// *** 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);
之后: //这不起作用:-(
// *** 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)”
当我评估 dataService.tastings 时,它看起来像是 chrome 控制台中的 firebase 参考,尽管已经添加了数据库等新属性。