Ember.js 余烬没有';t显示并获取模型
我正在尝试在灰烬中使用旋转木马滑块,但由于无法使灰烬获取我的图像,我已经在堆叠。这是我的代码: 应用程序: 路由器:Ember.js 余烬没有';t显示并获取模型,ember.js,ember-data,Ember.js,Ember Data,我正在尝试在灰烬中使用旋转木马滑块,但由于无法使灰烬获取我的图像,我已经在堆叠。这是我的代码: 应用程序: 路由器: ArtRank.Router.map(function (){ this.resource('index', {path: '/'}, function() { this.resource("home", {path: '/'}, function() { this.resource("photo", {pa
ArtRank.Router.map(function (){
this.resource('index', {path: '/'}, function() {
this.resource("home", {path: '/'}, function() {
this.resource("photo", {path: '/photo'});
});
this.resource('categories', { path: "/categories" });
this.resource('profile', { path: "/profile" });
});
});
ArtRank.PhotoRoute = Ember.Route.extend({
model: function() {
return this.store.find('photo');
}
});
型号:
ArtRank.Photo = DS.Model.extend({
imageTitle: DS.attr('string'),
imageUrl: DS.attr('string')
});
ArtRank.Photo.FIXTURES = [
{
id: 1,
imageTitle: 'Learn Ember.js',
imageUrl: 'http://getbootstrap.com/2.3.2/assets/img/bootstrap-mdo-sfmoma-01.jpg'
},
{
id: 2,
imageTitle: '...',
imageUrl: 'http://getbootstrap.com/2.3.2/assets/img/bootstrap-mdo-sfmoma-01.jpg'
},
{
id: 3,
imageTtitle: 'Profit!',
imageUrl: 'http://getbootstrap.com/2.3.2/assets/img/bootstrap-mdo-sfmoma-01.jpg'
}
];
我的模板由以下人员制作:
页眉和页脚内的索引和{{outlet}
Outelet call home.hbs即:{{partial photo}
home.hbs render photo.hbs即:
<div class="photos-wrap">
<h1>{{ imageTitle }}</h1>
<div class="photoItem">
<img id="photoItem" {{bind-attr src="imageUrl"}} />
</div>
</div>
{{imageTitle}}
非常感谢您的任何建议 模板中缺少each,因为reoute定义的模型挂钩的结果是一个数组
{{#each}}
<h1>{{ imageTitle }}</h1>
<div class="photoItem">
<img id="photoItem" {{bind-attr src="imageUrl"}} />
</div>
{{/each}}
祝你好运对于我自己的问题的答案(所以它不会一直打开),它一切正常,我只是不明白你需要进入特定的路由器来获取数据。我认为你可以从应用程序中的任何地方获取它们,但当然,只要在特定应用程序中显示即可。谢谢你,这是一个很好的观点,但不幸的是,这并不是问题,因为与余烬检查员一起查看,我根本不知道日期。My ArtRankPhoto为空:(尝试更改资源定义:-)
{{#each}}
<h1>{{ imageTitle }}</h1>
<div class="photoItem">
<img id="photoItem" {{bind-attr src="imageUrl"}} />
</div>
{{/each}}
this.resource('index', {path: '/'}, function() {
this.resource("home", {path: 'home'}, function() {