我有一个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) 采用最新(从GitHub今天)余烬和灰烬的数据,这段代码是给我一个错误 - 遗漏的类型错误:无法在余烬,数据读取latest.js的未定义的属性"发现":3170
// 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)修复了这个,但当然这不是很有用.
任何人都可以了解这里发生的事情吗?谢谢!