【发布时间】:2016-08-08 15:33:49
【问题描述】:
我有一个完全准系统的 express 应用,有一个 app.js 和一个像这样的 html 渲染引擎:
app.set('views', path.join(__dirname, '/views'));
app.engine('html', require('jade').renderFile);
app.set('view engine', 'html');
我希望 index.html 托管一个 Angular2 单页应用程序。在我的./views 目录中,我有一个 index.html 和一个 error.html 文件。我的 index.html 文件如下所示:
<head></head>
<h1>Home</h1>
<my-app>Loading...</my-app>
有了这个设置,一切正常。但是,如果我在头部添加任何内容,例如
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<h1>Home</h1>
<my-app>Loading...</my-app>
然后我现在得到错误页面,而不是 localhost 解析到索引。为什么?
【问题讨论】: