Skip to content

Instantly share code, notes, and snippets.

@riklaunim
Created February 24, 2016 09:49
Show Gist options
  • Save riklaunim/ae046c0225b1ecd66d47 to your computer and use it in GitHub Desktop.
Save riklaunim/ae046c0225b1ecd66d47 to your computer and use it in GitHub Desktop.
# contextual component
export default Ember.Component.extend({
tagName: 'h3',
classNames: ['timeline-header', 'no-border'],
icon: 'fa-envelope',
color: 'orange'
});
# contextual component template (simplified):
{{message.survey.name}}
# timeline-message component yielding contextual component (dynamic names)
{{yield (hash
timelineEntry=(component messageComponent message=message)
) messageComponent}}
# timeline-message usage
{{#timeline-message message=message as |context messageComponent|}}
{{#if messageComponent}}
<i class="fa {{context.timelineEntry.icon}} bg-{{context.timelineEntry.color}}"></i> # this does not work
<div class="timeline-item">
...
{{context.timelineEntry}} # this does work
</div>
{{/if}}
{{/timeline-message}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment