Skip to content Skip to sidebar Skip to footer

Nested Ejs Tag. Not Working

just a simple question but i cant find anything on it on google. So here it is, Why this doesn't work? on the 1st line, the last '%>' turns white This is from my NodeJS js file

Solution 1:

No, you can not use nested <% %>

You need to use just <% if (userProfile.facebook.length === 0) { %>

Like

<% if (userProfile.facebook.length === 0) { %>
    <h1>No Facebook!</h1>
<% } %>

Solution 2:

You don't have to rewrite ejs expression tag again inside if as if statement itself is in expression tag and will render the template variables without any problem.

Post a Comment for "Nested Ejs Tag. Not Working"