あるビューのモデルを部分的にロードしてから、別のビューのモデル全体をロードする方法を理解している人はいますか?
例えば:
/*
This will get all projects, so we only want an id and name returned from the server.
Each project is a monster, so we don't want all data for each project.
*/
App.ProjectsRoute = Ember.Route.extend({
model: function () {
return App.Project.find();
}
});
/*
This is a project detail, so we'd want the entire model returned from the server. Embedded records and all.
*/
App.ProjectRoute = Ember.Route.extend({
});
私が見つけることができる最も近いものはこれです: https://stackoverflow.com/a/14183507/1125563
その中で、私は次のようなことができます:
App.ProjectRoute = Ember.Route.extend({
setupController: function(controller, model) {
if (model.get('isTeaser')){
model.reload();
}
}
});
この回避策では、部分的にしかロードされていないかどうかを判断するためにいくつかのことをチェックする計算済みプロパティ isTeaser があります。
少し厄介であることを除けば、ここでの唯一の取引ブレーカーは、部分的にロードされたモデルを使用してルートに移行し、ロードされた後、すべてのものがエレガントにスナップインすることです.ファンではありません..
明らかな何かが欠けていますか?