Tuesday, 15 February 2011

javascript - #if field == req.locals.variable, render handlebars template? -



javascript - #if field == req.locals.variable, render handlebars template? -

here's idea:

{#if creatorfield == req.locals.user) <div class="thishtml">{{ story }}</div> {else} <div class="thathtml">{{ story }}</div> {/if}

if creatorfield not match req.locals.user value, different html template render. there functionality built-in, or need sort of helper?

logic should remain in controller, have boolean result of creatorfield == req.locals.user in handlebars context instead of computing within template, , utilize built-in if block helper.

javascript html node.js express handlebars.js

No comments:

Post a Comment