I am having a handlebar script code like this inside my ascx file.
<script id="ex" type="text/x-handlebars-template">
{{#each model}}
{{#if condition}}
//Need to Break, Dont know how to do that
{{/if}}
{{/each}}
</script>
Just pass this object it to a javascript function, do the required logic and return it.
<script type= "text/javascript">
Handlebars.registerHelper("ifSet", function (model) {
var count = 0;
while (count < model.length) {
// if (logic Condition){
// return 'Success'; or Break;
// }
}
return;
});
</script>
<script id="ex" type="text/x-handlebars-template">
{{ifSet model}}
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With