Skip to content

Instantly share code, notes, and snippets.

@Serabe
Forked from peabnuts123/components.my-component.js
Created January 27, 2018 23:41
Show Gist options
  • Save Serabe/86bea170cdc65cd008e27a2d9c62e3da to your computer and use it in GitHub Desktop.
Save Serabe/86bea170cdc65cd008e27a2d9c62e3da to your computer and use it in GitHub Desktop.
Tagless Element ES Class
import Ember from 'ember';
export default class MyComponent extends Ember.Component {
tagName = '';
constructor() {
super(...arguments);
// Empty string causes runtime error
// "Assertion Failed: You cannot use `elementId` on a tag-less component"
// Comment this line to fix
this.debug = "Lorem ipsum dolor sit amet";
}
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{my-component}}
{{outlet}}
<br>
<br>
<h1>My Component</h1>
<span>debug: {{debug}}</span>
{{yield}}
{
"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