Skip to content

Instantly share code, notes, and snippets.

@rtablada
Created June 23, 2019 15:38
Show Gist options
  • Save rtablada/14260b3780efaa892771ee2cfa766c13 to your computer and use it in GitHub Desktop.
Save rtablada/14260b3780efaa892771ee2cfa766c13 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
add(args) {
return args.reduce((a, b) => a + b, 0);
},
fullName(args, hash) {
return `${hash.first} ${hash.last}`
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export function exec([fn, ...rest], hash) {
return fn(rest, hash);
}
export default Ember.Helper.helper(exec);
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{my-component}}
<br>
<br>
{{exec this.add 1 2}}
{{exec this.fullName first="homer" last="simpson"}}
{
"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