Skip to content

Instantly share code, notes, and snippets.

@Herriau
Created December 17, 2015 22:06
Show Gist options
  • Save Herriau/fbcd391e75a14930912b to your computer and use it in GitHub Desktop.
Save Herriau/fbcd391e75a14930912b to your computer and use it in GitHub Desktop.
New Twiddle
{{foo-bar bar=whatever}}
import Ember from 'ember';
export default Ember.Component.extend({
foo: false,
bar: false,
classNameBindings: [':foo-bar', 'foo'],
onRerendered: function() {
$('body').append('did render!<br/>');
}.on('didRender'),
actions: {
toggleFoo: function() {
this.toggleProperty('foo');
},
toggleBar: function() {
this.toggleProperty('bar');
}
}
});
<button {{action "toggleFoo"}}>Touch foo</button>
<button {{action "toggleBar"}}>Touch bar</button>
.foo-bar {
padding: 10px;
border: 3px solid black;
background-color: purple;
}
.foo-bar.foo {
background-color: cyan;
}
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "1.13.11",
"ember-data": "1.13.15",
"ember-template-compiler": "1.13.11"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment