Skip to content

Instantly share code, notes, and snippets.

@seanjohnson08
Last active September 11, 2016 02:05
Show Gist options
  • Select an option

  • Save seanjohnson08/8aac350921a43eab78f351c47ca68de6 to your computer and use it in GitHub Desktop.

Select an option

Save seanjohnson08/8aac350921a43eab78f351c47ca68de6 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
const MAX_ROWS = 10;
export default Ember.TextArea.extend({
rows: Ember.computed('value', function() {
return Math.min(this.getWithDefault('value', '').split(/\r*\n/).length, MAX_ROWS);
})
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
textAreaValue: 'hello paul',
actions: {
clearText() {
this.set('textAreaValue', '');
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{text-area value=textAreaValue}}<br />
<button {{action "clearText"}}>Clear</button>
<br>
<br>
{
"version": "0.10.4",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment