mercredi 12 juillet 2017

Passing through properties when wrapping an Ember component

When wrapping an Ember component, how do I allow passing through a property while falling back to the inner component's default when omitting that property?

For example, take basic-input which gets wrapped by 'super-input':

components/basic-input.js

export default Component.extend({
  placeholder: "foo"
});

templates/components/basic-input.hbs



components/super-input.js

export default Component.extend({});

templates/components/super-input.hbs

<label>
  <span></span>
  
</label>

How do I allow super-input to passthrough the placeholder property to basic-input when it exists



but to use the default provided by basic-input when it does not?






Aucun commentaire:

Enregistrer un commentaire