Monday, February 26, 2024
 Popular · Latest · Hot · Upcoming
172
rated 0 times [  176] [ 4]  / answers: 1 / hits: 15584  / 6 Years ago, wed, august 1, 2018, 12:00:00

i just wanna ask simple i have an error like this




Error: Could not find matching close tag for <%=.
at C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesejslibejs.js:693:19
at Array.forEach ()
at Template.generateSource (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesejslibejs.js:678:15)
at Template.compile (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesejslibejs.js:557:12)
at Object.compile (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesejslibejs.js:389:16)
at handleCache (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesejslibejs.js:212:18)
at tryHandleCache (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesejslibejs.js:251:16)
at View.exports.renderFile [as engine] (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesejslibejs.js:482:10)
at View.render (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesexpresslibview.js:135:8)
at tryRender (C:UsersUserDocumentslatihannode.jsnodejs8librarynode_modulesexpresslibapplication.js:640:10)




and this is that i used code using ejs



<ul class=nav navbar-nav>
<% for(let i=0; i<nav.length; i++) { %>
<li>
<a href=<%=nav[i].link><%nav[i].title%></a>
</li>
<%}%>

</ul>


This is from my NodeJS js file. when i render the index i passed the index variable to EJS



app.get('/', (req, res) => {
res.render(
'index',
{
nav: [{ link: '/buku', title: 'Buku' },
{ link: '/penulis', title: 'Penulis' }],
title: 'library'
}
);
});

More From » node.js

 Answers
156

You should close href with %>.



 <a href=<%=nav[i].link%>><%nav[i].title%></a>

[#53834] Friday, July 27, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maxinec

Total Points: 117
Total Questions: 116
Total Answers: 116

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
maxinec questions
;