Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Contextual Components Part 1
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
isOpen: true,
actions: {
toggle() {
this.toggleProperty('isOpen');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Route to Contextual Components',
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#collapsible-panel as |panel| }}
{{#panel.header}}
Section 1
{{/panel.header}}
{{#panel.body}}
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
{{/panel.body}}
{{/collapsible-panel}}
<br>
<br>
{{yield (hash
header=(component 'collapsible-panel-header' onClick=(action 'toggle'))
body=(component 'collapsible-panel-body' isOpen=isOpen)
)}}
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment