samedi 13 juin 2015

Access child controller property from parent controller

I have a flyers route that has a template called flyers.hbs

<div class="button-wrap">
    <button {{action 'back'}}>Go Back</button>
    {{#if isPrintable}}
        <button {{action 'print'}} class="float-right">Print Flyer</button>
    {{/if}}
</div>

{{outlet}}

In this flyers route I have view and new. New should only show the back button and view should show the back button and the print button. So in the view controller I specified a property like so.

import Ember from 'ember';

export default Ember.Controller.extend({
    isPrintable: true,
});

But obviously the parent controller for flyers does not see that property when I navigate to the view route so my print button is not showing.

What is the proper way to do this?

Aucun commentaire:

Enregistrer un commentaire