Skip to content

Instantly share code, notes, and snippets.

@davidpett
Last active August 20, 2016 16:04
Show Gist options
  • Save davidpett/7f7dc8d76bd856af6d68439ae4a86f3a to your computer and use it in GitHub Desktop.
Save davidpett/7f7dc8d76bd856af6d68439ae4a86f3a to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
classNameBindings: [
'isSelected'
],
isSelected: false,
actions: {
toggleSelected() {
this.toggleProperty('isSelected');
}
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.is-selected {
background-color: yellow;
}
<button {{action 'toggleSelected'}}>with actions</button>
or <button {{action (action (mut isSelected) (if isSelected false true))}}>closure actions</button>
{
"version": "0.10.4",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment