新Firebase中的Firebase篝火 [英] Firebase angularfire in new firebase

查看:108
本文介绍了新Firebase中的Firebase篝火的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个角度的应用程序,它使用了angularFire库。在firebase文档中指出,angularfire支持 https://firebase.google。 com / support / guides / firebase-web#update_your_firebase_libraries_numbered



我已经将firebase和angularfire更新到最新版本。 b $ b

BEFORE:// This works :-)

  // *** DataService *** 

var root = new Firebase(FIREBASE_URL);

var service = {
root:root,
items:root.child('items'),
tastings:root.child('tastings'),
用户:root.child('users'),
votes:root.child('votes')
};

退货服务;

// ***控制器***
$ b $ scope.tastings = $ firebaseArray(dataService.tastings);

AFTER://这行不通: - (



  // *** 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'),
用户:root.child('users'),
votes:root.child('votes')
};

返回服务;

// ***控制器***

$ scope.tastings = $ firebaseArray(dataService.tastings);

我得到的错误是:必须将有效的Firebase引用传递给$ firebase(不是字符串或URL)

看起来像在Chrome控制台中的firebase引用,当我评估dataService.tastings,虽然有新的属性这个数据库已经被添加了。

解决方案

AngularFire现在正式更新以支持Firebase 3.xx:)


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

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: //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); 

The error I am getting: "Must pass a valid Firebase reference to $firebase (not a string or URL)"

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 is now officially updated to support Firebase 3.x.x :)

这篇关于新Firebase中的Firebase篝火的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆