Skip to content

Instantly share code, notes, and snippets.

@HusseinMorsy
Created May 27, 2016 07:51
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 HusseinMorsy/37a82dfc255080dc344ca271128d5608 to your computer and use it in GitHub Desktop.
Save HusseinMorsy/37a82dfc255080dc344ca271128d5608 to your computer and use it in GitHub Desktop.
Counter-Esma
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
developer: 'Esma',
year: 2016,
counter: 0,
actions: {
up() {
const counter = this.get('counter');
this.set('counter', counter + 1);
},
down() {
const counter = this.get('counter');
this.set('counter', counter -1)
},
reset() {
this.set('counter', 0);
}
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
p {
color: #00CC00;
}
<h1>Welcome to {{appName}}</h1>
<br>
<p> Counter: {{counter}}
<button onclick={{action 'up'}}>up</button>
<button onclick={{action 'down'}}>down</button>
</p>
{{outlet}}
<br>
<br>
<p>Programmiert von {{developer}} {{year}}</p>
<button onclick={{action 'reset'}}>Zurücksetzen</button>
{
"version": "0.8.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.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment