我有一个模型模型/人
{
firstName: DS.attr( 'string'),
lastName: DS.attr( 'string'),
email: DS.attr( 'string' ),
}
和另一个模型模型/项目
{
name: DS.attr( 'string' ),
code: DS.attr( 'string' ),
startDate: DS.attr( 'date' ),
endDate: DS.attr( 'date' ),
users : DS.hasMany('person', {async: true}),
}
然后我将所有项目作为包含 ember 对象的数组检索。因为项目 -> 用户是异步的,所以它是一个承诺。我想使用该人的名字对该数组进行排序。当数据相应到达并重新渲染正在使用列表的 hbs
我有一个名为的计算属性
renderProjects = computed ('model.projects.[]')
{
// trying to sort in here but data is not avaiable so its not getting sorted
}