Skip to content

Instantly share code, notes, and snippets.

@jbandura
Created January 16, 2020 19:53
Show Gist options
  • Save jbandura/51c3a92f287d1f5c40bcf5d7a44df0de to your computer and use it in GitHub Desktop.
Save jbandura/51c3a92f287d1f5c40bcf5d7a44df0de to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
prop1: Ember.computed('appName', function() {
return this.get('appName') + '!';
}),
prop2: Ember.computed('appName', {
get(key) {
return this.get('appName') + '!';
},
set(value) {
return value;
}
}),
actions: {
doAction() {
this.set('prop1', 'new prop1');
this.set('prop2', 'new prop2');
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
Prop1: {{prop1}}
<br>
Prop2: {{prop2}}
<b>
<button {{action "doAction"}}>Do action</button>
<br>
<br>
{
"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