Javascript 编译ejs时partials\messages.ejs中的参数列表后缺少)
下面是注册页面的代码,我在解析messages.ejs文件时遇到了代码问题。我在线上有一个语法错误 语法错误:Javascript 编译ejs时partials\messages.ejs中的参数列表后缺少),javascript,node.js,ejs,Javascript,Node.js,Ejs,下面是注册页面的代码,我在解析messages.ejs文件时遇到了代码问题。我在线上有一个语法错误 语法错误: missing ) after argument list in D:\Website Practice\Nodejs\node_passport_login_project\views\partials\messages.ejs while compiling ejs 能帮点忙吗 <div class="row mt-5"> <div class="col
missing ) after argument list in D:\Website Practice\Nodejs\node_passport_login_project\views\partials\messages.ejs while compiling ejs
能帮点忙吗
<div class="row mt-5">
<div class="col-md-6 m-auto">
<div class="card card-body">
<h1 class="text-center mb-3">
<i class="fas fa-user-plus"></i> Register
</h1>
<%- include('./partials/messages') %>
<form action="/users/register" method="POST">
<div class="form-group">
<label for="name">Name</label>
<input
type="name"
id="name"
name="name"
class="form-control"
placeholder="Enter Name"
value="<%= typeof name != 'undefined' ? name : '' %>"
/>
</div>
<button type="submit" class="btn btn-primary btn-block">
Register
</button>
</form>
<p class="lead mt-4">Have An Account? <a href="/users/login">Login</a></p>
</div>```
</div>
</div>
登记
名称
登记
有账户吗
```
消息文件中的代码如下所示
您需要定义
函数
并传递参数
试试这个,希望对您有所帮助
<% if(typeof errors != 'undefined' ){ %>
<% errors.forEach(function(error) { %>
<%= error.msg %>
<% }); %>
<% } %>
您需要定义
函数
并传递参数
试试这个,希望对您有所帮助
<% if(typeof errors != 'undefined' ){ %>
<% errors.forEach(function(error) { %>
<%= error.msg %>
<% }); %>
<% } %>