简体   繁体   中英

Ember-data and #each

I'm trying to follow the example in the Ember guide but with ember-data. Here is my router:

App.Router = Ember.Router.extend({
  enableLogging: true,
  root: Ember.Route.extend({
    index: Ember.Route.extend({
      route: '/',
      redirectsTo: 'orders'
    }),
    orders: Ember.Route.extend({
      route: '/orders',
      connectOutlets: function(router) {
        router.get('applicationController').connectOutlet('orders', App.store.findAll(App.Order));
      }
    }),
    order: Ember.Route.extend({
      route: '/orders/:ord_id'
    })
  })
});

And in my template:

{{#each order in controller}}
...
{{/each}}

I get this error: TypeError: 'undefined' is not an object (evaluating 'c.split')

It works using an ArrayController. I changed this:

App.OrdersController = Ember.Controller.extend();

to this:

App.OrdersController = Ember.Controller.extend();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM