-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
One feature that Ember's Handlebars offers is the ability for blocks to yield an object:
{{#my-details as |details|}}
<button onclick={{details.toggle}}>
{{#if details.isOpen 'Close' 'Open'}}
<button>
{{#if details.isOpen}}
the content that gets toggled
{{/if}}
{{/my-details}}The HTMLX feature that comes closest is {#each cats as cat}. If you loosen the syntax just slightly to allow a JavaScript express instead of each cats, but still only allow a single yielded object, the above could be written as
{#new MyDetails() as |details|}
<button onclick={details.toggle}>
{details.isOpen ? 'Close' 'Open'}
<button>
{#if details.isOpen}
the content that gets toggled
{/if}
{/as}
evrowe and topaximaxmilton and tomatrow
Metadata
Metadata
Assignees
Labels
No labels