Skip to content

Instantly share code, notes, and snippets.

@brianshano
Last active February 15, 2018 17:13
Show Gist options
  • Select an option

  • Save brianshano/d7cd48aaf845639fa97b645be91a24da to your computer and use it in GitHub Desktop.

Select an option

Save brianshano/d7cd48aaf845639fa97b645be91a24da to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
displaySettings: {
"events": false,
"new-events": false,
"old-events": false,
},
actions: {
toggleDisplay(val) {
console.log('toggle value of', val);
this.toggleProperty('displaySettings'+'.'+val);
},
}
});
Toggle object values
{{#each-in displaySettings as |name value|}}
<div>
{{name}}: {{value}}
<button {{action 'toggleDisplay' name}}>
toggle</button>
</div>
{{/each-in}}
{
"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