Skip to content

Instantly share code, notes, and snippets.

@sduquej
Created November 21, 2017 14:26
Show Gist options
  • Save sduquej/215673650833e6d823c89ccd290e136f to your computer and use it in GitHub Desktop.
Save sduquej/215673650833e6d823c89ccd290e136f to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['class-0'],
init() {
this._super();
// this.classNames = this.classNames.slice();
this.classNames.pushObjects(['WOLOLO']);
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
number: 1,
classForMyThing: Em.computed('number', function() { return `class-${this.get('number')}`; }),
actions: {
incrementNumber() {
this.incrementProperty('number');
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
{{number}}
<br>
{{
my-component
classNames=classForMyThing
}}
<button {{action 'incrementNumber'}}>Increment</button>
<br>
<br>
{
"version": "0.12.1",
"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.8.2",
"ember-template-compiler": "2.8.2",
"ember-testing": "2.8.2"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment