Skip to content

Instantly share code, notes, and snippets.

@brianshano
Created September 14, 2016 11:20
Show Gist options
  • Select an option

  • Save brianshano/df6d82ab0568da70c1c168174606149a to your computer and use it in GitHub Desktop.

Select an option

Save brianshano/df6d82ab0568da70c1c168174606149a to your computer and use it in GitHub Desktop.
Bubbling up component action
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
clickybox: false,
appName: 'Ember Twiddle',
actions: {
clicky() {
console.log('clickity click');
this.toggleProperty('clickybox', true);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<button {{action "clicky"}}>Normal action button</button>
{{boxy-box}}
{{#if clickybox}}
Clicky button clicked!
{{/if}}
<br>
<br>
{{yield}}
<div class="boxy">
This is a box component
<button {{action "clicky"}}>click ici</button>
</div>
{
"version": "0.10.5",
"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.8.0",
"ember-data": "2.8.0",
"ember-template-compiler": "2.8.0",
"ember-testing": "2.8.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment