vendredi 23 février 2018

Handlebars #if not working inside #forEach

I need to render a table, with links that will be displayed if the user has admin rights. I have a #forEach and inside it, an . isAdmin is a helper that for the moment simply returns true or false. If I render it displays the value correctly (true, false) but if I try to evaluate it with nothing happens. My code:

Nodejs custom helper:

var hbs = handlebars.create({
        partialsDir: [
            'view/partials/'
        ],
        helpers:{
            isAdmin: function(){
                return true;
            }
        }
    });

HTML - HANDLEBARS

      
<tr>
    <td></td>
    <td></td>
    <td></td>
    <td>
        <a href="/view/">View</a>            
        
        <a href="/versions/">Details & Changes</a>
        
    </td>
</tr>    
  

The link "Details & Changes" is never displayed. any ideas?

Aucun commentaire:

Enregistrer un commentaire