Skip to content

Instantly share code, notes, and snippets.

@jkarsrud
Created September 28, 2018 10:14
Show Gist options
  • Save jkarsrud/a767bc846984f5e18cb40c71d22e2c07 to your computer and use it in GitHub Desktop.
Save jkarsrud/a767bc846984f5e18cb40c71d22e2c07 to your computer and use it in GitHub Desktop.
Class on component
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['foo'],
didInsertElement() {
this.set('allOfTheClasses', this.element.classList);
},
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
{{#my-component class="bar"}}
Boo
{{/my-component}}
{{yield}}
<p>All of the classes: {{allOfTheClasses}}</p>
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.1.4",
"ember-template-compiler": "3.1.4",
"ember-testing": "3.1.4"
},
"addons": {
"ember-data": "3.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment