I'm trying to load two different models on the same route, I found a stack overflow that explained I can use Ember.RSVP.hash() to get this done, here is what I've done to make it work.
model: function(params) {
return Ember.RSVP.hash({
flyer: this.store.find('flyer', params.flyer_id),
images: this.store.find('image', '-Jrgar1tSArUw-_PiJqX')
});
},
As you can see I have hard coded the id of the images record I need to load, this should come from the returned flyer like so flyer.imagesID
But when I do that I get an error in the console, this is the stack trace...
Error while processing route: flyers flyer is not defined ReferenceError: flyer is not defined
at model (http://localhost:4200/assets/flyer-creator.js:338:38)
at EmberObject.default.extend.deserialize (http://localhost:4200/assets/vendor.js:32872:19)
at applyHook (http://localhost:4200/assets/vendor.js:55667:32)
at Object.HandlerInfo.runSharedModelHook (http://localhost:4200/assets/vendor.js:53668:22)
at Object.subclass.getModel (http://localhost:4200/assets/vendor.js:53894:21)
at __exports__.bind (http://localhost:4200/assets/vendor.js:55536:19)
at tryCatch (http://localhost:4200/assets/vendor.js:55993:16)
at invokeCallback (http://localhost:4200/assets/vendor.js:56005:17)
at publish (http://localhost:4200/assets/vendor.js:55976:11)
at http://localhost:4200/assets/vendor.js:37026:7
Is there a way to access the flyer property that's returned from the hash in the next property?
Aucun commentaire:
Enregistrer un commentaire