Skip to content

Instantly share code, notes, and snippets.

@thousand
Last active March 12, 2019 01:39
Show Gist options
  • Select an option

  • Save thousand/885f825d162bb9bb17d226fb58197fe1 to your computer and use it in GitHub Desktop.

Select an option

Save thousand/885f825d162bb9bb17d226fb58197fe1 to your computer and use it in GitHub Desktop.
Buttonz
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button',
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
buttonAction(e) {
if (!e) debugger;
console.log('click', e);
}
}
});
<h1>Welcome to {{appName}}</h1>
<h2>Outside Buttons</h2>
<button {{action "buttonAction"}}>Native Outside Button</button>
{{#my-button click=(action "buttonAction")}}Component Outside Button{{/my-button}}
<h2>Form Buttons</h2>
<form>
<button {{action "buttonAction"}}>Native Form raw action Button</button>
<button onclick={{action "buttonAction"}}>Native Form onClick Button</button>
{{#my-button click=(action "buttonAction")}}Component Form Button{{/my-button}}
</form>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment