我的 Ember 应用无法识别 FirebaseAdapter

FirebaseAdapter not recognized on my Ember app

我正尝试在我的 Ember 应用中使用 Firebase。我安装了 Emberfire 但我的应用 returns

Uncaught TypeError: Cannot read property 'extend' of undefined

因为它不读 'FirebaseAdapter'

App.ApplicationAdapter = DS.FirebaseAdapter.extend({
    firebase: new Firebase('https://glowing-fire-number.firebaseio.com/')
});

我检查了 Ember 数据是否在 Firebase 和 EmberFire 之前加载。这是我的脚本参考:

<!-- script references -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="http://maps.googleapis.com/maps/api/js?sensor=false&extension=.js&output=embed"></script>
    <script src="js/scripts.js"></script>

<script src="js/libs/jquery-1.11.2.min.js"></script> 
<script src="js/libs/handlebars-v1.3.0.js"></script>
<script src="js/libs/ember.js"></script>
<script src="js/libs/moment.js"></script>
<script src="http://builds.emberjs.com/tags/v1.0.0-beta.12/ember-data.js"></script>

<script src="js/app.js"></script>
<script src="vendor/list-view.js"></script>
<script src="js/controller.js"></script>

<script src="https://cdn.firebase.com/js/client/2.2.2/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/emberfire/1.3.3/emberfire.min.js"></script>

还有我的App.js

App = Ember.Application.create();

App.Router.map(function() {
  // put your routes here
  this.resource('stacks')
  this.resource('stack', {path: ':stack_id'}, function() {
        this.route('edit');
    }); 
    this.route('create');
  });


App.IndexRoute = Ember.Route.extend({
  beforeModel: function() {
    this.transitionTo('stacks');
  }
});

App.StacksRoute = Ember.Route.extend({
    model: function() {
        return this.store.findAll('stack');
    }
});

App.StackRoute = Ember.Route.extend({
    model: function(params) {
        return stacks.findBy('id', params.stack_id);
    }
});

Ember.Handlebars.helper('format-date', function(date) {
    return moment(date).fromNow();
});


App.CreateRoute = Ember.Route.extend({

});


//EmberFire stuff

App.ApplicationAdapter = DS.FirebaseAdapter.extend({
    firebase: new Firebase('https://glowing-fire-2514.firebaseio.com/')
});

App.Stack = DS.Model.extend({
  title: DS.attr('string'),
  location: DS.attr('string'),
  date: DS.attr('number'),
  details: DS.attr('string')
});

有什么想法吗?感谢您的帮助!

看起来您需要在包含 EmberFire 之后包含 app.jsthis.resource('stacks') 之后您的路由器中还缺少一个分号,但我认为这不是导致错误的原因。

我们刚刚发布了一些更新,可以更轻松地将 EmberFire 作为 ember-cli 插件使用,我建议您查看一下。详情在这里:https://www.firebase.com/blog/2015-03-09-new-emberfire-features.html