Skip to content

Instantly share code, notes, and snippets.

@spsaul20
Last active January 4, 2018 08:21
Show Gist options
  • Save spsaul20/8e5f4b68f0c271cb159c12fe5b8b8dee to your computer and use it in GitHub Desktop.
Save spsaul20/8e5f4b68f0c271cb159c12fe5b8b8dee to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
init(){
this._super(...arguments);
this.set('initial_value', this.get('value'));
},
change(e){
console.log('value should be reset to ' + this.get('initial_value'))
this.set('value', this.get('initial_value'));
//this.set('value', 'hello');
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
value: 'initial value'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
{{my-component value=value}}
<br>
<input type="text" value={{value}}>
{
"version": "0.13.0",
"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.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment