小编Joh*_* H.的帖子

Ember-data fixtures适配器未加载所有数据

我有一个ember-data模型定义,如下所示:

Sylvius.Filter = DS.Model.extend({
  title: DS.attr('string'),
  slug: DS.attr('string'),
  // Belongs to Atlas
  atlas: DS.belongsTo('Sylvius.Atlas'),
  // Has images
  images: DS.hasMany('Sylvius.Image'),
  // May have AtlasExtras
  extras: DS.hasMany('Sylvius.AtlasExtra'),
  // Structures for this filter
  structures: DS.hasMany('Sylvius.Structure'),
  // This is the path to the thumbnails sprite.
  // Each image will have an index on this sprite
  thumbnailUrl: DS.attr('string'),
  // How big is each thumbnail?
  thumbnailHeight: DS.attr('number'),
  thumbnailWidth: DS.attr('number'),
  // How big are the images? 
  imageHeight: DS.attr('number'),
  // which image is selected?
  selectedImage: DS.belongsTo('Sylvius.Image') …
Run Code Online (Sandbox Code Playgroud)

ember.js ember-data

4
推荐指数
1
解决办法
2227
查看次数

Ember数据 - 未捕获的TypeError:无法读取未定义的属性"find"

采用最新(从GitHub今天)余烬和灰烬的数据,这段代码是给我一个错误 - 遗漏的类型错误:无法在余烬,数据读取latest.js的未定义的属性"发现":3170

http://jsfiddle.net/Bf43W/9/

// only needed on JSFiddle; this is to trigger the route
history.pushState("", "", "/projects/1/tasks");

App = Ember.Application.create({});

App.store = DS.Store.extend({
    revision: 4,
    adapter: DS.RESTAdapter.create()
});

App.Project = DS.Model.extend({
    name: DS.attr('string')
});

App.ApplicationController = Ember.ObjectController.extend({
});

App.ApplicationView = Ember.View.extend({
    templateName: 'application'
});

App.TasksView = Ember.View.extend({
    templateName: 'tasks'
});

App.Router = Ember.Router.extend({
    root: Ember.Route.extend({
        tasks: Ember.Route.extend({
            route: '/projects/:project_id/tasks',
            connectOutlets: function(router) {
                router.get('applicationController').connectOutlet('Tasks');
            }
        })
    })
});

App.router = App.Router.create({
    location: 'history'
});

App.initialize(App.router);
Run Code Online (Sandbox Code Playgroud)

改变:在路径中的projects_id到其他东西(例如1,所以它匹配URL)修复了这个,但当然这不是很有用.

任何人都可以了解这里发生的事情吗?谢谢!

ember.js ember-data

1
推荐指数
1
解决办法
8124
查看次数

标签 统计

ember-data ×2

ember.js ×2