samedi 21 novembre 2015

How pass value declared in application controller to component

In my application controller, i have the following:

export default Ember.Controller.extend({
  isOpen: true,

  actions: {
    toggleSidebar () {
      this.toggleProperty('isOpen');
    }
  }
});

And i would like to pass the isOpen to a component that is being called from other templates (not application.hbs), like:

{{#main-main isOpen=isOpen}}
{{/main-main}}

because inside the component i have:

export default Ember.Component.extend({
    tagName: 'main',
    classNames: ['main'],
    classNameBindings: ['isOpen:main--active'],
});

I was thinking that should work just like this.. but it doesn't.

What could i do to pass the property isOpen to the component main-main?

Thank you guys!




Aucun commentaire:

Enregistrer un commentaire