Per the Ember guides, you can determine if a component is being rendered in block format from within the template using the hasBlock
keyword:
// foo-component.hbs
{{#if hasBlock}}
block mode
{{else}}
something else
{{/if}}
How do I do this from within foo-component.js
?
import Ember from 'ember';
export default Ember.Component.extend({
didInitAttrs: function() {
// hasBlock is not defined here
if ( this.get('hasBlock') ) {
}
}
});
Aucun commentaire:
Enregistrer un commentaire