Skip to content

Instantly share code, notes, and snippets.

@inez
Created November 12, 2018 19:13
Show Gist options
  • Save inez/ce9f1f9db9ecace3b610abdf02b93e5c to your computer and use it in GitHub Desktop.
Save inez/ce9f1f9db9ecace3b610abdf02b93e5c to your computer and use it in GitHub Desktop.
readonly and mut
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
ourValue: 1,
actions: {
increse: function() {
this.set('ourValue', 1 + Math.abs(this.get('ourValue')));
},
onkeyup: function(e) {
this.set('ourValue', e);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
Input value: {{ourValue}}
<br><br>
Input: {{input
value=(readonly ourValue)
key-up='onkeyup'
}}
<br>
<br>
<button {{action 'increse'}}>INC</button>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment