title: How to render HTML conditionally in javascript
body: <pre><code>var template = '';
  template = template + '&lt;div class="form-group col-lg-12"&gt;';
  template = template + '&lt;label  class="control-label"' + '' + object.required == true ? ' required' : '' + '&gt;';
  </code></pre>
  
  <p>in above line <code>obj.required = true</code>. So, <strong>true == true</strong> </p>
  
  <p><strong>Hence,</strong> the template should have following html in the end </p>
  
  <pre><code>&lt;div class="form-group col-lg-12"&gt;&lt;label  class="control-label required"&gt;
  </code></pre>
  
  <p>But it returns only</p>
  
  <pre><code>"&gt;"
  </code></pre>
  
  <p>I belive my html embed code is not correct.
  I did hard to find wrong but couldn't find.</p>
  
  <p>Can you please find and suggest?</p>