Skip to content

Instantly share code, notes, and snippets.

@mehulkar
Last active September 3, 2020 16:09
Show Gist options
  • Save mehulkar/92329dd6e159d976f5a638acf9786929 to your computer and use it in GitHub Desktop.
Save mehulkar/92329dd6e159d976f5a638acf9786929 to your computer and use it in GitHub Desktop.
New Twiddle
<div ...attributes>i am tagless</div>
import Component from '@ember/component';
export default class extends Component {
tagName = '';
}
import Component from '@ember/component';
export default class extends Component {
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
<h1>Classic Components and classes</h1>
<h2>Outer Tag + angle bracket invocation</h2>
<p>Classic components with an outer tag accept <code>@class=</code> <i>and</i> <code>class=</code> and automtically apply them to the other tag. Example:</p>
<WithOuterTag @class="yo" class="hi" />
<hr />
<h2>Tagless + angle bracket invocation</h2>
<p>Classic components without an outer tag (i.e. that set <code>tagName: ''</code>), do not do anything with <code>@class=</code>, but will apply <code>class=</code> attributes passed in angle brackets to wherever <code>...attributes</code> is inside the component. Example:</p>
<Tagless @class="yo" class="hi" />
<hr />
<h2>Tagless + curly invocation</h2>
<p>
With curly bracket syntax, <code>class=</code> will NOT be applied to <code>...attributes</code>. Example:
</p>
{{tagless class="yo"}}
<hr />
{
"version": "0.17.1",
"EmberENV": {
"FEATURES": {},
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false,
"_APPLICATION_TEMPLATE_WRAPPER": true,
"_JQUERY_INTEGRATION": true
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js",
"ember": "3.18.1",
"ember-template-compiler": "3.18.1",
"ember-testing": "3.18.1"
},
"addons": {
"@glimmer/component": "1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment