handlebars.net

HandleBars .Net If Comparision

我的梦境 提交于 2020-01-23 02:42:13
问题 I use Handlebars .NET for my mail templates so i generate template at server side width ASP.NET MVC. I need a comparision like this. But it doest't work? What can I do? //Product.ProdType is a enum property {{#if (Product.ProdType=='BlaBlaBla')}} <p>This is a test</p> {{/if}} 回答1: I had the same problem and I created a helper function "ifCond" that works with numeric data types and string. It can be optimized or expanded to work with other types. Handlebars.RegisterHelper("ifCond", (writer,

How to output block with handlebars dot net conditional helper?

試著忘記壹切 提交于 2020-01-05 07:14:41
问题 I have the following helper for handlebars.net: Handlebars.RegisterHelper("#is", (writer, context, args) => { string val1 = args[0].ToString(); string val2 = args[1].ToString(); if (val1 == val2) { //how to get block output } }); I am trying to test it on the following html, but I am not sure how to write out the content between {#is} and {/is} if it is true: <div style="text-align: right;"> {{#each TeamMembers}} {{#is this.Title 'Manager'}} {{ this.Name }}<br /> {{ this.PersonalEmail }}<br /

How to output block with handlebars dot net conditional helper?

好久不见. 提交于 2020-01-05 07:14:19
问题 I have the following helper for handlebars.net: Handlebars.RegisterHelper("#is", (writer, context, args) => { string val1 = args[0].ToString(); string val2 = args[1].ToString(); if (val1 == val2) { //how to get block output } }); I am trying to test it on the following html, but I am not sure how to write out the content between {#is} and {/is} if it is true: <div style="text-align: right;"> {{#each TeamMembers}} {{#is this.Title 'Manager'}} {{ this.Name }}<br /> {{ this.PersonalEmail }}<br /