idrakiMuhamad
idrakiMuhamad

Reputation: 43

How to use params pass through template in Dustjs/Krakenjs

I'm still new in Kraken.js and Dust, so need some help in this.

For example, I'm including a partial template like below:

{> "modal/modalDialog" type="assign" /}

Then I have that template looks like below, which placed in some other folder, and I want to do conditional checking, if the type is "assign", I want to show some text, else, do something else. I tried using {@eq} like below, but its not working.

<div id="{type}" class="modal">
  {@eq key=type value="assign"}Assign this{/eq}
  {@eq key=type value="user"}Introduce us{/eq}
</div>

I know I can define the value in the JS model etc, but thinking there must be a way to do without the need to define in controller. Or

Upvotes: 0

Views: 126

Answers (1)

rragan
rragan

Reputation: 484

Offhand that looks correct. My guess is that you have managed to get two versions of dust loaded and the helpers have registered with one and you are using the other one. That would mean the eq helper is not being found and silently failing. You can confirm this by setting dust.debugLevel='WARN'.

If that is the problem, try explicitly using the 1.1.1 version of dustjs-helpers in your package.json. This all ought to be ironed out once a recent change to dustjs-helpers to make dust a peer dependency gets published.

Upvotes: 1

Related Questions