Skip to content

Instantly share code, notes, and snippets.

@kellyselden
Created June 23, 2016 23:40
Show Gist options
  • Save kellyselden/e4801208572aec5b0548553293a83afd to your computer and use it in GitHub Desktop.
Save kellyselden/e4801208572aec5b0548553293a83afd to your computer and use it in GitHub Desktop.
input binding
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
count: 4,
rawCount: 4,
actions: {
update(value) {
if (value > 999) {
this.set('count', 999);
} else {
this.set('count', value);
}
this.set('rawCount', value);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
count: {{count}}
<br>
rawCount: {{rawCount}}
<br>
<input type="number" value={{count}} oninput={{action "update" value="target.value"}} />
{{outlet}}
<br>
<br>
{
"version": "0.9.3",
"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"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment