IOT SOFTWARE PLATFORM DOCS

Table of Contents

  • Onboarding
  • Devices Manager
  • Assets Manager
  • Account Manager
  • Tutorials - How To?
  • Smart Solutions
  • LoRaWAN
  • APIs
  • Concepts & Terminology
  • Mobile App
  • Release Notes
  • Integrated LNS
  • dokuwiki
  • Live Demo
IOT SOFTWARE PLATFORM DOCS
You are here: Welcome ! » Tutorials - How To? » How to use handlebars to display conditional content?
Trace: • How to use handlebars to display conditional content?

How to use handlebars to display conditional content?

We have recently added handlebars features to allow conditional content in the dynamic notes widget.

You can add an if else statement around text and do a text comparison using the gt, gte, lt, lte, eq comparator in the if condition.

You can either type the handlebars in the WiziWig editor

{{#if (gte Var 0) }} ↗ {{{Var}}}% {{else}} ↘ {{{Var}}}% {{/if}}

or switch it to html mode “</>” and type the handlebars such as this

<h5 style="text-align: center; ">
<span style="font-weight: bold;">
  {{#if (gte Var 0) }} <span style="color: rgb(255, 0, 0);">↗ {{{Var}}}%</span>&nbsp;
  {{else}} <span style="color: rgb(107, 165, 74);">↘ {{{Var}}}%</span> 
  {{/if}}
</span>
</h5>

Previous Next