Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created January 26, 2018 19:55
Show Gist options
  • Save GavinJoyce/a19f71586224be85a9d94a09b008bfe5 to your computer and use it in GitHub Desktop.
Save GavinJoyce/a19f71586224be85a9d94a09b008bfe5 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
version: Ember.VERSION,
name: 'Alex',
capitalizedName: Ember.computed('name', function() {
return Em.String.capitalize(this.get('name'));
}),
actions: {
change(name) {
this.set('name', name);
}
}
});
<h1>{{version}}</h1>
name: {{name}} ({{capitalizedName}})
<hr>.
<button onclick={{action 'change' 'Ben'}}>Ben</button>
<button onclick={{action 'change' 'Sophie'}}>Sophie</button>
<button onclick={{action 'change' null}}>null</button>
<hr>
Try Ember 2.16.2 and 2.12.0. Notice the difference in behavior after clicking the `null` button.
{
"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