Skip to content

Instantly share code, notes, and snippets.

@hjumeau
Last active February 25, 2016 17:11
Show Gist options
  • Save hjumeau/75427c45c132984fc464 to your computer and use it in GitHub Desktop.
Save hjumeau/75427c45c132984fc464 to your computer and use it in GitHub Desktop.
inputHelpers
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
{{user-form}}
<br>
<br>
{
"version": "0.6.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.3.1/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.3.3/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
import Ember from 'ember';
export default Ember.Component.extend({
name:null,
actions: {
showValue(){
alert(this.get('name'));
},
clearName(){
this.set('name', null);
}
}
});
<pre>
+--------------------+----------------+
| | |
| event | attribute name |
+--------------------+----------------+
| new line inserted | insert-newline |
| | |
| enter key pressed | insert-newline |
| | |
| cancel key pressed | escape-press |
| | |
| focusin | focus-in |
| | |
| focusout | focus-out |
| | |
| keypress | key-press |
| | |
| keyup | key-up |
| | |
| keydown | key-down |
+--------------------+----------------+
</pre>
<br>
{{name}}
<br>
{{input type='text' value=name insert-newline=(action 'showValue') escape-press=(action 'clearName')}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment