Skip to content

Instantly share code, notes, and snippets.

@skitterm
Last active May 1, 2017 23:10
Show Gist options
  • Save skitterm/0bc580c454ea7f9d25d2aeae626845a1 to your computer and use it in GitHub Desktop.
Save skitterm/0bc580c454ea7f9d25d2aeae626845a1 to your computer and use it in GitHub Desktop.
Textarea woes
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.food = 'Burger';
},
actions: {
changeFood() {
this.set('food', 'Macaroni');
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.food = 'Burger';
},
actions: {
changeFood() {
this.set('food', 'Macaroni');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h2>Textarea</h2>
<ol>
<li>Click "change food". The text field will update to "Macaroni".</li>
<li>Refresh the page.</li>
<li>Type some text into the textarea, then click "change food". The value doesn't change to "Macaroni".</li>
</ol>
{{textarea-woes}}
<hr>
<h2>Input</h2>
<ol>
<li>Click "change food". The input field will update to "Macaroni".</li>
<li>Refresh the page.</li>
<li>Type some text into the input, then click "change food". The value will change to "Macaroni".</li>
</ol>
{{input-happiness}}
<input value={{food}}>
<button {{action "changeFood"}}>Change food</button>
<textarea>{{food}}</textarea>
<button {{action "changeFood"}}>Change food</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