我使用以下方法在 IndexRoute 中提取模型数据:
我有一个正在传递通知的组件。
不过,我需要能够反转这些通知的顺序。
问题是,由于我将多个模型拉入 IndexRoute - 我无法在 IndexController 内部使用 sortProperties
。
有人知道如何在将它们发送到组件之前或从组件本身内部对它们进行排序吗?
谢谢!
最佳答案
您应该能够使用 Controller 的 Sortable
mixin 来为您执行此操作...
App.IndexController= Ember.ArrayController.extend({
sortFunction(x,y) {
// here check for model type and make comparison between x and y
}
});
将排序属性设置为包含类型信息的内容,例如 meta
部分。如果您没有这样的标识符,则可能需要实现 orderBy
。
关于javascript - 组件内的逆序 Ember 模型集合?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21127288/