我正在Ember.js应用程序中工作,当前正在尝试连接到Firebase(这不是我的默认适配器,默认是Rest适配器)。我遵循了 https://github.com/firebase/emberfire 中的说明,但是当我尝试从数据库中读取数据时,我得到了:
Error while processing route: my.routingFile firebase.app is not a function getApp
简而言之,这是我的路由文件:
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import RouteMixin from 'ember-cli-pagination/remote/route-mixin';
import Ember from 'ember';
import RealtimeRouteMixin from 'emberfire/mixins/realtime-route';
export default Ember.Route.extend(AuthenticatedRouteMixin,RouteMixin, RealtimeRouteMixin, {
firebaseApp: Ember.inject.service(),
model(params) {
return this.store.findAll('myModel');
},
setupController(){
this._super(...arguments);
},
actions:{
}
});
而且,我的适配器的定义如下:
import RealtimeDatabaseAdapter from 'emberfire/adapters/realtime-database';
export default RealtimeDatabaseAdapter.extend({
databaseURL: 'https://my-url.firebaseio.com/'
});
我的ember-cli版本是:3.0.2
那我想念什么?
答案 0 :(得分:0)
我很惊讶它不起作用。您的代码对我来说很好。您是否在config/environment.js
中为Firebase定义了环境变量?