node.js - 在 express 中访问部分视图时出现问题
问题描述
这是我的视图文件:views/profile.ejs
<body>
<% include partial/nav.ejs %>
<!-- <%- include('partial/nav.ejs'); %> -->
<h1> Welcome to <%= person %> profile</h1>
<p>
<strong>The age: </strong><%= proObj.age%>
</p>
<p>
<strong>Relationship Status: </strong><%= proObj.relation_status%>
</p>
<div>
<p>
<strong>Hobbies: </strong>
<% hobbies.forEach(function(item){ %>
<li> <%= item %> </li>
<% }); %>
</p>
</div>
</body>
和这个部分视图文件:views/partial/nav.ejs
<nav>
<ul>
<li><a href="">Home</a></li>
<li><a href="">Contact</a></li>
当我重新加载网站时,我将这个错误弹出到服务器中
SyntaxError: Unexpected identifier in C:\Users\Fo0ola\Desktop\SERVER-SIDE\views\profile.ejs while compiling ejs
解决方案
推荐阅读
- json - 反序列化动态 JSON 对象
- spring - 由于 ora 12519,无法打开 Hibernate Session 进行事务处理
- c# - 使用正则表达式提取子字符串
- c - MinGW编译说头文件丢失,可能是哪个包丢失了?
- c# - 如何在asp.net mvc中将部分视图下载为word文档?
- javascript - Git日志图到数组中
- ruby-on-rails - 从 rspec 获取请求中删除授权
- html - Angular6 - 在下拉列表中渲染图像
- html - 调整窗口大小后将框保持在正确位置
- arduino - WiFiClientSecure ESP8266 上的 400 错误请求