[[Missing),然后在编译ejs时在partials \ messages.ejs中的参数列表之后

编程入门 行业动态 更新时间:2024-10-08 06:23:59

[[Missing),然后在编译ejs时在partials \ messages.ejs中的<a href=https://www.elefans.com/category/jswz/34/1771441.html style=参数列表之后"/>

[[Missing),然后在编译ejs时在partials \ messages.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-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((error){ %>
        <%= error.msg %>
    <% }) %>
<% } %>
回答如下:

[您需要定义function并传递argument,请尝试此希望它有帮助!!

    <% if(typeof errors != 'undefined' ){ %> 
      <% errors.forEach(function(error) { %>
          <%= error.msg %>
        <% }); %>
     <% } %>

更多推荐

[[Missing),然后在编译ejs时在partials \ messages.ejs中的参数列表之后

本文发布于:2024-05-07 14:00:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1756579.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   列表   ejs   Missing   messages

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!