Implementing different views for the same route


#1

Hi all,

I’ve been tinkering around trying to mimic Instgram’s routing behavior with Ember.js but I have not had much success. Let’s stick with Instagram as an example: I’m essentially trying to load an image into a modal if it is accessed directly on the list page; but, if accessed from a url, the image has it’s own page.

URLs for refrence:

To me it appears that they are doing some sort of query params manipulation.

Does any one have any advice?


#2

Anyone tackle this before?


#3

Create a component that you can then use both inside your modal, and on the /:image_id route.

I’d suggest you avoid using query params for that. Use a RESTful route instead.


#4

Thanks @gregone, I’ve modularized it into a component! I’m reading up on http://guides.emberjs.com/v1.12.0/routing/rendering-a-template/ to try to complete this “widget” now.


#5

Similar topic on stackoverflow http://stackoverflow.com/questions/31051083/adding-route-to-a-modal-overlay-in-ember-js