Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Contextual Popover Component
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
Click the below button to toggle.
<br>
<br>
{{#popover-container isShowing=true as |popover|}}
{{#popover.handle tagName="button"}}
Toggle
{{/popover.handle}}
{{#popover.content}}
Content
{{/popover.content}}
{{/popover-container}}
import Ember from 'ember';
export default Ember.Component.extend({
isShowing: false,
actions: {
toggle() {
this.toggleProperty('isShowing');
}
}
});
{{yield (hash
handle=(component 'popover-handle' click=(action 'toggle'))
content=(component 'popover-content' isShowing=isShowing)
)}}
import Ember from 'ember';
export default Ember.Component.extend({
});
{{#if isShowing}}
{{yield}}
{{/if}}
import Ember from 'ember';
export default Ember.Component.extend({
});
{
"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": "release",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "release"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment