【发布时间】:2015-12-31 10:51:41
【问题描述】:
我使用 ejs 作为模板语言。
<main class="content">
<% documents.forEach(function(documentObject) { %>
<h1><a href="/showprofile/:username"><%= documentObject.username %></a> solved </h1>
<h2><%= documentObject.problem_id %>. <%= documentObject._statement %> in
<%= documentObject.time %> seconds on
<%= documentObject.date_added %> . </h2>
<% }) %>
</main>
我正在使用动态路由/showprofile/:username 进行重定向。我需要以这样的方式制作超链接,以便 documentObject.username 的值作为参数传递给 :username 。我该怎么做?
【问题讨论】:
标签: node.js express routing ejs