Skip to content

Instantly share code, notes, and snippets.

@azizpunjani
Last active October 21, 2018 18:12
Show Gist options
  • Save azizpunjani/6346ad72c29622bfb33c to your computer and use it in GitHub Desktop.
Save azizpunjani/6346ad72c29622bfb33c to your computer and use it in GitHub Desktop.
Contextual components yielding multiple blocks
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
{{#my-component as |cmp|}}
{{#cmp.header}}
Header
{{/cmp.header}}
{{#cmp.body}}
Body
{{/cmp.body}}
{{#cmp.footer}}
Footer
{{/cmp.footer}}
{{/my-component}}
import Ember from 'ember';
export default Ember.Component.extend({
});
<div id="body">
{{yield}}
</div>
import Ember from 'ember';
export default Ember.Component.extend({
});
{{yield
(hash
header = (component 'my-header')
body = (component 'my-body')
footer = (component 'my-footer')
)
}}
import Ember from 'ember';
export default Ember.Component.extend({
});
<div id="header">
{{yield}}
</div>
{
"version": "0.5.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.3.0",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "2.3.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment