Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
New Twiddle
import Ember from 'ember';
var counter=1;
export default Ember.Controller.extend({
model: [{id: 2, mark: 'blue'},{id: 1, mark: 'red'}],
appName: 'Ember Twiddle',
count: counter,
shipmentType: 'regularDelivery',
actions: {
countUp() {
counter++;
this.set('count', counter);
},
}
});
<h1 onmousemove={{action "countUp"}}>Welcome to {{appName}}</h1>
<h3>Count: {{count}}</h3>
<button {{action "countUp"}}>Count!</button>
<br><br>
Change title: {{input value=appName}}
<br>
<ul>
{{#each model as |thing|}}
<li>Mark #{{thing.id}}: {{thing.mark}}</li>
{{/each}}
</ul>
<p>The mouse X position is: {{mouseX}}</p>
<div class="draw-canvas" onmousemove={{action (mut mouseX) value="screenX"}}>
<p>Select shipment type: <b style="color:#FF0000">{{shipmentType}}</b></p>
<button onclick={{action (mut shipmentType) "regularDelivery"}}>Standard delivery</button>
<button onclick={{action (mut shipmentType) "urgent"}}>48h delivery</button>
<button onclick={{action (mut shipmentType) "next-day"}}>Next day delivery</button>
</div>
{{outlet}}
{
"version": "0.5.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.