John John - 8 months ago 64
Javascript Question

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 enter image description here

This is from my NodeJS js file. when i render the "loginuserprofile" i passed the userProfile variable to EJS
This is from my NodeJS js file
and i'll get an error of

Error: Could not find matching close tag for "<%".

i cant use nested <% %>?

Thank you!


Yes, You can not use nested <% %> ?

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


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