2016-07-07 30 views
-2

我在路线:访问attribure afterr搜索(查询)

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; 
}, 

});

我需要从我校获得属性的categoryId,但是当我在里面写:

fot(let i in itm){ 
    console.log(i.id); 
} 

不工作。怎么做?

这我需要从好物品找到类别。

非常感谢您的回答!

+0

'fot'应该是'for'。 –

+0

是的,但它是一个错字。当我尝试它时,我看到错误! –

+0

什么错误,'itm'存在? –

回答

0

我做到了!此代码,我需要:

this.store.query('product', { 
      uriName: params.item_name 
     }).then(function(items) { 
      items.forEach(function(item) { 
       console.log(item.get('categoryId')); 
      }); 
     });