How to pass arguments to dynamic model0


#1

I want to pass two (or more) arguments to this.store.find() ; I have app.router.js like

Router.map(function() {
  this.route('photos');
  this.route('photo', { path: '/photo/:photo_id' });
});

and

dynamic route’s model

model(params) {
    return this.store.findRecord('photo', params.photo_id);
  }

this will go to /photo/photo_id

now I tried to pass couple of arguments then it was giving error: no model is defined for some_photo_it (say id) I tried this:

model(params) {
    return this.store.findRecord('photo', params.photo_id,{param1:0, param2:25});
  }

but It was giving error like: Error: More context objects were passed than there are dynamic segments for the route: error

please answer.


#2

I’m not sure I follow your question. Do you mean you want to the store to return two photos?


#3

@vikram7 I am new to ember and Sorry I mixed the question, now I edited it. I want to go to url:

...someURL/photos/{photo_id}?param1=0&param2=25

where {photo_id} can change dynamically But I know only these that: I can pass it like:

this.store.find('phoso',photo_id);

this will result a get request : ...someURL/photos/photo_id

where photo_id is dynamically changing . And I can also pass it like:

this.store.find('photo',{param1=0,param2=25})

this will result like:

...someURL/photos?param1=0&param2=25

but I want the get request like:

...someURL/photos/photo_id?param1=0&param2=25

Hope I am able to clearly express the question…