搜索(查询)后访问属性
Access to attribure afterr search (query)
我在路线中:
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
let city = params.city_name;
let cuc = this.store.query('city', {
linkname: city,
});
let itm = this.store.query('product', {
uriName: params.item_name,
});
let dictpage = {
currentCity: cuc,
currentProduct: itm,
};
return dictpage;
},
});
我需要从 cuc 获取属性 categoryId,但是当我在那里写的时候:
fot(let i in itm){
console.log(i.id);
}
不工作。怎么做?
这个我需要从好的项目中找到类别。
提前感谢您的回答!
我做到了!这段代码做的,我需要的:
this.store.query('product', {
uriName: params.item_name
}).then(function(items) {
items.forEach(function(item) {
console.log(item.get('categoryId'));
});
});
我在路线中:
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
let city = params.city_name;
let cuc = this.store.query('city', {
linkname: city,
});
let itm = this.store.query('product', {
uriName: params.item_name,
});
let dictpage = {
currentCity: cuc,
currentProduct: itm,
};
return dictpage;
},
});
我需要从 cuc 获取属性 categoryId,但是当我在那里写的时候:
fot(let i in itm){
console.log(i.id);
}
不工作。怎么做?
这个我需要从好的项目中找到类别。
提前感谢您的回答!
我做到了!这段代码做的,我需要的:
this.store.query('product', {
uriName: params.item_name
}).then(function(items) {
items.forEach(function(item) {
console.log(item.get('categoryId'));
});
});