Skip to content

Instantly share code, notes, and snippets.

@pichfl
Created February 14, 2017 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pichfl/37d1d91ecdda7c055aabe8b35d5e86c8 to your computer and use it in GitHub Desktop.
Save pichfl/37d1d91ecdda7c055aabe8b35d5e86c8 to your computer and use it in GitHub Desktop.
ActionsUp
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button',
result: 0,
click() {
this.set('result', Math.random());
const result = this.get('result');
this.get('onResult')(result);
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
value: null,
actions: {
showResult(result) {
this.set('value', result);
},
},
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{a-component onResult=(action 'showResult')}}
<strong>{{value}}</strong>
{{outlet}}
<br>
<br>
{
"version": "0.11.0",
"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.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment