Dinkheller
Dinkheller

Reputation: 5054

Add a partial inside a partial in Dust

I need to pass values to a dust template in the following manner:

<div class="o-outer">
    {>"atoms/button" text="{+filteredClass/}"/}
</div>

{<filteredClass}
    {@customFilter _key="MENU" /}
{/filteredClass}

Any idea how to achive this?

Upvotes: 0

Views: 94

Answers (1)

smfoote
smfoote

Reputation: 5609

I think you will want to define a custom filter instead of a helper with a custom filter. See http://www.dustjs.com/docs/filter-api/ for details on how to create a custom filter. Then you will be able to do:

<div class="o-outer">
    {>"atoms/button" text="{text|myFilter}"/}
</div>

This all assumes that your customFilter helper is actually being used in the same way that Dust filters are used. If not, then you will probably need a different solution.

Upvotes: 1

Related Questions