Sharing properties across the application


#1

What is the best way to pass a value up to the application route from a child route?

Basically I want a component to be rendered in application.hbs and a property passed to it which is defined in one of the child routes.

structure:

  • routes/application - has property renderPhoto
  • routes/user-profile (extends application route)

if I set renderPhoto in user-profile I want routes/application.renderPhoto to be that value - so that in the template in application.hbs when I do

{{#some-component renderPhoto=renderPhoto }}

it will use the value set in user-profile

Does that make sense?


#2

Hope this helps and I am not sure it’s the best way but this is how I do it from routes to components and other routes.

/someRoute.js/

 export default Ember.Route.extend({
   afterModel: function(){
     this.set('riverClass','move-1 step-1');
     this.container.lookup('component:river-state').set('riverClass','move-1 step-1');
   },
   actions: {
     didTransition: function(){
       this.container.lookup('component:time-remaining').initTimer(5.0);
     }
   }
 });

Picture-in-Picture modal?