0
我有一個將在/products
路徑下加載的產品列表,從那裏您可以導航到/products/:product_id
下的單個產品。這是我的機型和路線:將額外的數據加載到仍在商店中的EmberData模型中
var Product = DS.Model.extend({
page_title: DS.attr('string'),
image: DS.attr('string')
});
var ProductComment = DS.Model.extend({
contents: DS.attr('string')
});
var ProductRoute = Ember.Route.extend({
model: function(params) {
return App.Product.find(params.product_id)
},
setupController: function(controller, model) {
controller.set('content', model);
}
});
在產品頁面上,我想載入產品以及產品的註釋。當我使用外部Api時,我不能將註釋的ID加載到產品模型中。所以現在我想將註釋加載到ProductsController中。我嘗試了像這個SO中描述的,但它不起作用。我正在使用EmberDatas RESTAdapter。