How to use if statements in a for loop in Hogan js

I am new to node js. I use Express JS and Hogan JS engine template. I know that we cannot use the logic in this template, but I need to execute the if statement inside the for statement in the view code to generate table fields. I have tried so many things, Even I follow these Hogan js links .

But there is only, if so, for example, a solution is given for both at the same time.

My details on this form

[ 
    { 
     buln_id: 1,
     name: 'Himanshu',
     cname: 'India',
     created_date: 'Tue Jul 07 2015',
     state_name: 'Chandigarh',
     city_name: 'Chandigarh',
     locality_name: 'Behlana',
     office_type_name: 'SCO',
     office_number: '1234',
     floor_no: 'ground floor',
     section: 'a',
     owner_name: 'RAvi',
     mob_no: '123456789',
     email_name: 'aaa@gmail.com',
     web_name: 'sss.com',
     landmark: 'sss',
     bus_info: 'IT',
     service: 'sss',
     pay_details: 'Cash',
     net_surrfing: 'a',
     verification: 1 
     },
     { 
      buln_id: 5,
      name: 'User1',
      cname: 'India',
      created_date: 'Sat Aug 01 2015',
      state_name: 'Chandigarh',
      city_name: 'Chandigarh',
      locality_name: 'Maloya',
      office_type_name: 'SCF',
      office_number: 'a',
      floor_no: 'Ground Floor',
      section: 'a',
      owner_name: 'a',
      mob_no: '123456789',
      email_name: 'a@gmail.com',
      web_name: 'a',
      landmark: 'a',
      bus_info: 'aa',
      service: 'a',
      pay_details: 'cash',
      net_surrfing: 'mobile',
      verification: 1 
      }

]

Here I want to generate a table according to the data and where it is check 1. I want to put a check sign, otherwise put a cross sign. Please help me, I am new to this area.

Thanks at Advance.

+4
1

 <table>
     <thead>
        <tr>
          <th>Owner Name</th>
          <th>Address</th>
          <th>Contact</th>
          <th>Bussiness  info</th>
          <th>User</th>
          <th>Created Time</th>
          <th>Verification</th>
         </tr>
      </thead>
      <tbody>
      {{#allRecords}}
        <tr>
          <td>{{owner_name}}</td>
          <td>{{office_type_name}}-{{office_number}}, {{locality_name}}
                                {{city_name}}, {{state_name}}, {{cname}}</td>
           <td>{{mob_no}}<br>{{email_name}}</td>
           <td>{{service}}</td>
           <td>{{name}}</td>
           <td>{{created_date}}</td>
           {{#verification}}
           <td><i class="fa fa-check fa-2x green"></i></td>
           {{/verification}}
           {{^verification}}
           <td><i class="fa fa-exclamation-triangle fa-2x red"></i></a></td>
           {{/verification}}
         </tr>
           {{/allRecords}}
        </tbody>
     </table>
+3

Source: https://habr.com/ru/post/1607587/


All Articles