Skip to content

Instantly share code, notes, and snippets.

@pbishop16
Last active December 24, 2017 04:16
Show Gist options
  • Save pbishop16/ecc22e60e45e4fb0390c9756f07a84ee to your computer and use it in GitHub Desktop.
Save pbishop16/ecc22e60e45e4fb0390c9756f07a84ee to your computer and use it in GitHub Desktop.
Basic Ember Increment Example
import Ember from 'ember';
export default Ember.Component.extend({
heat: 0,
init() {
this._super(...arguments);
this.set('errors', []);
},
actions: {
increaseHeat() {
this.incrementProperty('heat');
},
},
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{increment-component}}
<br>
<br>
<h2>Temperature:</h2>
<h3>Current: {{heat}}</h3>
<button {{action "increaseHeat"}}>Add Heat</button>
{
"version": "0.12.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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment