Last active
September 30, 2016 18:04
-
-
Save k-fish/e681d14f3dbcd011e01fc7388eec13da to your computer and use it in GitHub Desktop.
Input change example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
didReceiveAttrs({ newAttrs: { value }}) { | |
if (value) { | |
const v = value.value || value; | |
this.set('_internalValue', v); | |
} | |
}, | |
modifyInput(value) { | |
return 15; | |
}, | |
_internalValue: Ember.computed('value', { | |
get(key) { | |
return this.get('value'); | |
}, | |
set(key, value) { | |
return this.get('value'); | |
} | |
}), | |
actions: { | |
inputChanged({ target }) { | |
let value = target.value; | |
console.log(value); | |
value = this.modifyInput(value); | |
this.attrs.inputChanged(value); | |
target.value = value; | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.5", | |
"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.8.0", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment