Skip to content

Instantly share code, notes, and snippets.

@nightire
Created March 12, 2020 15:53
Show Gist options
  • Save nightire/d98090036fa3dd0f8b1e70d3a2c92c0e to your computer and use it in GitHub Desktop.
Save nightire/d98090036fa3dd0f8b1e70d3a2c92c0e to your computer and use it in GitHub Desktop.
Unique GUID
import Component from '@ember/component';
export default class extends Component {
}
import Component from '@ember/component';
export default class extends Component {
}
import Component from '@ember/component';
import { guidFor } from '@ember/object/internals';
export default class extends Component {
get contentId() {
return guidFor(this);
}
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
<h1>Welcome to {{this.appName}}</h1>
<Accordion as |a|>
<a.heading>Heading</a.heading>
<a.content>Content</a.content>
</Accordion>
{{yield}} - content id: {{@contentId}}
{{yield}} - content id: {{@contentId}}
{{yield (hash
heading=(component "accordion/heading" contentId=this.contentId)
content=(component "accordion/content" contentId=this.contentId)
)}}
{
"version": "0.17.0",
"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.3.1/jquery.js",
"ember": "3.17.0",
"ember-template-compiler": "3.17.0",
"ember-testing": "3.17.0"
},
"addons": {
"@glimmer/component": "1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment