I have simple Node.js web app with login/registration functionality through passport. In the nav bar I have two buttons: Login and Register. What I would like to do is when the user is on the Registration page, only display the Login button in the nav bar, when the user is on the Login Page only display the Register button in the nav bar. How can I achieve this in my header ejs file?
I tried this:
<% if (document.URL.contains("login")) { %>
<li><a href="/login">Sign In</a></li>
<% } else { %>
<li><a href="/register">Sign Up</a></li>
<% } %>
Problem with this is that the document variable is not defined in my ejs locals...and I don't think I can define it as a local? At least when I tried I get an error that document is not define...makes sense since this is done in the app.js file.
How can I achieve this functionality?
Thanks!
via user2573690
No comments:
Post a Comment