How to pass slideshow data to component


#1

My background is in php and I’m new to javascript so bare with me. I’ve chosen ember based on its philosophy and direction, but need a little help if thats ok.

Every page on my website has a slideshow in the header. I’m trying to build a component that displays however made slides based on the page. I think I need to pass some data from the pages router to the component within the page template.

I’ve already built a couple components so I’m not completely stupid. But they are pretty basic, I’m just passing things like title and body via handlebars.

But back to making a slideshow (yes I know there is already an ember slideshow addon but I need to learn this stuff since I’ll be using it everyday so I’m going to DIY route).

I data the slideshow needs to act on can be hard coded, as its not going to be updated once deployed.

Each slide would be able to have an image, a title, and some content.

I would like to set this content in the route for each page.

The component needs to loop through each item returned from the route and display the info.

I’ve been reading the docs over and over again, but sorry I’m a slow learner. Any pointers or help is really appreciated. Even someone just pointing me in the right direction would be great, as I want to make it right the first time.


#2

Ok I’ve made some progress on this, and I am passing data into my component.

But my component is located in application, not each pages view. But its data needs to change based on each pages view. The slideshow is on every page…

How do I update the component in application view with data from the sub router view?


#3

I think it’d be worth looking at something like ember-wormhole — as that lets you render a component into a different part of the hierarchy.


#4

You just saved me soooo much time. Thank you bro!