I'm trying to create a condition for grouping the controls in a form-group
, but handlebars
is duplicating the components on the screen.
What I want is that when FormGroupBegin
is equal to true
it inserts <div class="form-group">
in the same way FormGroupEnd
<script id="partialAtributos" type="text/x-handlebars-template">
{{#if FormGroupBegin}}
<div class="form-group">
{{/if}}
<div class="{{ ClassesCss }}">
<div class="control-label col-md-12">
<label>{{ Rotulo }}</label>
</div>
<div class="col-md-12">
<input type="{{ _tipoHtml }}" name="{{ Identificador }}" class="form-control" maxlength="{{ Tamanho }}" required />
<span id="{{ Identificador }}-label" class="hide field-validation-error">{{ MensagemDeErro }}</span>
<i class="form-group__bar"></i>
</div>
</div>
{{#if FormGroupEnd}}
</div>
{{/if}}
</script>
My if
Handlebars.registerHelper('if', function (conditional, options) {
if (conditional) {
return options.fn(this);
}
});