我试图引导与Ember 1.0.0-RC1的小型应用程序。应用程序将使用图像做一些事情。我没有任何应用程序的后端,所以我试图在我已经嵌入到网页源代码中的一些JSON上使用FixtureAdapter。如何在Ember.js中将默认商店设置为FixtureAdapter?
不幸的是,我似乎无法正确挂钩的商店。我不断收到有关需要设置YourAppName.Store的错误。
Uncaught Error: assertion failed: Your application does not have a 'Store' property defined. Attempts to call 'all' on model classes will fail. Please provide one as with 'YourAppName.Store = DS.Store.extend()'
但除非我已经完全错过了一些东西,我没有将它设置:
window.YIH = Ember.Application.create();
YIH.Photo = DS.Model.extend({
url: DS.attr('string'),
});
YIH.Photo.FIXTURES = JSON.parse(document.getElementById('images').innerHTML);
YIH.Store = DS.Store.extend({
revision: 12,
adapter: DS.FixtureAdapter
});
YIH.photoController = Em.ArrayController.create({
content: YIH.Photo.all(), // blows up
})
我砍死周围试图使这项工作设置其他属性,但无济于事。
http://emberjs.com/guides/getting-started/using-fixtures/ – hiwaylon 2013-11-30 17:25:46