Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jicksta/ce60f65f621670ac42c6 to your computer and use it in GitHub Desktop.
Save jicksta/ce60f65f621670ac42c6 to your computer and use it in GitHub Desktop.
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 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,
child: Ember.Component.extend({
tagName="section"
}),
actions: {
toggle() {
this.set('isShowing', !this.get('isShowing'));
}
}
});
{{yield (hash
handle=(component 'popover-handle' click=(action 'toggle'))
content=(component child)
)}}
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