John John - 1 year ago 182
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!

Answer Source

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>
<% } %>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download