0

I want my detail page to include 2 little links(with image) like "next 2 news". How can I do it? my twiddle: https://ember-twiddle.com/b9cd8b1b3418d876f88235c4aa99e268?openFiles=templates.pic.hbs%2Ctemplates.components.image-list.hbs

In my detail page which is "pic" route, I print the selected image's bigger version and its content. How am I gonna add two more little pics,to the bottom of the page for example, which are next 2 news' links? If I use "model.blah" it only takes the one I selected. Is there any other way?

EDIT : Twiddle has Changed, and an explanation of why I dont think this question is a duplicate

The reason I'm seeing this question different from others is that: I dont have multiple models as you can see from the twiddle, I have a service and I call it as a model. Also I'm using a dynamic URL, for every detail page. My requirement is, when I click an image in the homepage, how can I print both clicked picture's image,content and also next 2 data's(JSON) image to the detail route("pic")? right now I'm only showing one image and content,-which I clicked.

hbc
  • 43
  • 9

1 Answers1

0

you need to pass multiple models to controller from pic route. something like that.

model() {
    return Ember.RSVP.hash({
      selectedpic: this.store.findRecord('Image', params.id),
      nextPic: this.store.findRecord('Image', params.nextpicid),
          });
  },

 setupController(controller, models) {
    controller.set('pic', models.selectedpic);
    controller.set('nextPic', models.nextPic);
    // or, more concisely:
    // controller.setProperties(models);
  }

its just idea to solve your problem. you need to change it according to your requirements. http://emberigniter.com/load-multiple-models-single-route/

Muhammad Ateek
  • 1,057
  • 3
  • 14
  • 24
  • yeah but the point is, I only have one model and I use generic URL. so I my problem is, from the same json, when I click an image in the homepage, how can I print both clicked picture's image,content and also next 2 data's image to the detail route? right now I'm only showing one image and content. I dont have 2 or more different models – hbc May 30 '16 at 13:43