Skip to content

Instantly share code, notes, and snippets.

@noyesa
Last active July 11, 2016 20:40
Show Gist options
  • Save noyesa/d258f051104526741b7ce2d58cb1b16d to your computer and use it in GitHub Desktop.
Save noyesa/d258f051104526741b7ce2d58cb1b16d to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
someValue: 0,
otherValue: 0,
computedValue: Ember.computed('otherValue', function() {
return this.get('someValue') + this.get('otherValue');
}),
actions: {
clickFirst() {
this.incrementProperty('someValue');
},
clickSecond() {
this.incrementProperty('otherValue');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{my-component}}
{{yield}}
<br/>
someValue + otherValue = {{computedValue}}
<br/>
<button {{action "clickFirst"}}>Increment someValue</button>
<button {{action "clickSecond"}}>Increment otherValue</button>
{
"version": "0.10.1",
"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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment