Skip to content

Instantly share code, notes, and snippets.

@feanor07
Forked from marcuswoy/components.input-helper.js
Last active December 20, 2016 18:52
Show Gist options
  • Save feanor07/f0032191ca765abeb7176548a266a239 to your computer and use it in GitHub Desktop.
Save feanor07/f0032191ca765abeb7176548a266a239 to your computer and use it in GitHub Desktop.
Input Example2
import Ember from 'ember';
export default Ember.Component.extend({
tagName:'input',
attributeBindings:['type','style','value'],
init() {
this._super(...arguments);
this.on('paste', this, this._elementValueDidChange);
this.on('cut', this, this._elementValueDidChange);
this.on('input', this, this._elementValueDidChange);
},
_elementValueDidChange() {
Ember.set(this, 'value', this.element.value);
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
width:100,
actions:{
setWidth(value){
console.log(value);
}
}
});
<h1>Welcome to {{appName}}</h1>
{{outlet}}
<form {{action 'setWidth' width on='submit'}}>
{{input-helper value=width class="form-control" style="width:50px; color:black"}}
</form>
{
"version": "0.10.7",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js",
"ember": "beta",
"ember-data": "beta",
"ember-template-compiler": "beta",
"ember-testing": "beta"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment