2017-10-21 85 views
0

的问题余烬:this._ref.push不是一个函数

我似乎得到余烬与下面的错误,我也跟着文档,但仍然得到错误:

Uncaught TypeError: this._ref.push is not a function 
    at Class.generateIdForRecord (firebase.js:75) 
    at Class._generateId (-private.js:10359) 
    at Class.createRecord (-private.js:10325) 
    at Class.test (home.js:13) 
    at Class.send (action_handler.js:32) 
    at action.js:141 
    at exports.flaggedInstrument (ember-metal.js:3730) 
    at action.js:140 
    at Backburner.run (backburner.js:537) 
    at run (ember-metal.js:4267) 

下面的代码是错误来自的地方,代码只是放在一个名为home的控制器中的一个动作中:

var newGlobal = this.store.createRecord('global', { 
    about: 'test', 
}); 
newGlobal.save(); 

数据库的规则是设置为:

{ 
    "rules": { 
    ".read": true, 
    ".write": true 
    } 
} 

并且数据库为空。

我还设置config/environment.js

任何想法吗?

预先感谢您

有用的链接

emberfire

Emberfire guide

Found these issues but they didn't help with my issue

回答

0

这是现在解决了,问题是我创造了一个自定义的余烬服务称为firebase

我曾在home控制器注入它像这样:

firebase: Ember.inject.service() 
相关问题