これはコードの図です:http: //jsbin.com/uzapuy/1/edit
次のようなURLでテストにアクセスできるようにしたい:http: //jsbin.com/uzapuy/1#/test/2 entrieはすでにクライアント側に存在する可能性があるため、最初に、フェッチが欠落している場合にのみ確認したいサーバー側から。DS.Storeなしでそれは可能ですか?
これはコードの図です:http: //jsbin.com/uzapuy/1/edit
次のようなURLでテストにアクセスできるようにしたい:http: //jsbin.com/uzapuy/1#/test/2 entrieはすでにクライアント側に存在する可能性があるため、最初に、フェッチが欠落している場合にのみ確認したいサーバー側から。DS.Storeなしでそれは可能ですか?
あなたのTestRoute
では、次のようなことはできませんか?
App.TestRoute = Ember.Route.extend({
model: function(params) {
// Find your controller that has the "fetch" method.
var testController = this.controllerFor('test');
// Check if there's an existing model with this ID.
var existingModel = testController.find('id', params.id);
// Determine if we found a model or not.
if (existingModel) {
// If we found an existing model, then we can set this as the model.
return existingModel;
}
// Otherwise we'll fetch it from the server.
return testController.fetch(params.id);
}
});
また、コードでは、test
変数はundefined
次のようになることに注意してください。
var tests = App.Test.create({id: id, name: 'fetched ' + id});
self.set('content', test);
あなたは後tests
だと思います。