Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1215
IgniteUI Template Engine JavaScript Error
posted

I get a JavaScript error when attempting to use the IgniteUI template engine {{if}} statement in the code below. (I'm using this in an MVC model, when creating a GridModel GridColumn template.)

The first block of script fails with a JavaScript error. The second two blocks work without errors.

The only big difference I can see is that there are two {{if}} statements in the first block of code. If I comment either {{if}} statement out, the code works! But including both {{if}} statements generates an error.

Produces JavaScript error:
{{if ${VG_GROUP} == 'True' }}
<div class="d-flex align-items-center container" style="white-space: nowrap; font-size: 24pt;">
{{else}}
<div class="d-flex align-items-center container" style="white-space: nowrap; font-size: 12pt;">
{{/if}}
{{if ${VG_GROUP} == 'True' }}
<img src="trigger-load-images-onerror" width="16" height="16" >
{{/if}}
</div>

This code works:
{{if ${VG_GROUP} == 'True' }}
<div class="d-flex align-items-center container" style="white-space: nowrap; font-size: 24pt;">
{{else}}
<div class="d-flex align-items-center container" style="white-space: nowrap; font-size: 12pt;">
{{/if}}
</div>

This code also works:
<div class="d-flex align-items-center container" style="white-space: nowrap; font-size: 12pt;">
{{if ${VG_GROUP} == 'True' }}
<img src="trigger-load-images-onerror" width="16" height="16" >
{{/if}}
</div>

Parents
No Data
Reply
  • 0
    Offline posted

    It looks like the issue you're encountering is due to improper nesting of the {{if}} statements in the first block of code. The IgniteUI template engine might not handle multiple {{if}} statements in close proximity, especially when they're not properly structured or closed. To resolve this, try separating your conditional logic into distinct blocks, ensuring each {{if}} is closed properly before starting the next one. royalxcasino.one . {{if ${VG_GROUP} == 'True' }}
    <div class="d-flex align-items-center container" style="white-space: nowrap; font-size: 24pt;">
    {{else}}
    <div class="d-flex align-items-center container" style="white-space: nowrap; font-size: 12pt;">
    {{/if}}
    {{if ${VG_GROUP} == 'True' }}
    <img src="trigger-load-images-onerror" width="16" height="16" >
    {{/if}}
    </div>

Children
No Data