Javascript 子文件夹的角度路由出错

Javascript 子文件夹的角度路由出错,javascript,angularjs,node.js,ngroute,angularjs-ng-route,Javascript,Angularjs,Node.js,Ngroute,Angularjs Ng Route,我在一个项目中编写了两个ng应用程序,一个是user,另一个是admin。 要从url中删除#,我在app.config函数中都使用了下面的代码 $locationProvider.html5Mode(true); 和in-app/index.html <base href="/"> <base href="/admin/"> server.js app.use('/', express.static('app', { redirect: false })); a

我在一个项目中编写了两个
ng应用程序
,一个是
user
,另一个是
admin
。 要从url中删除
#
,我在app.config函数中都使用了下面的代码

$locationProvider.html5Mode(true);
和in-app/index.html

<base href="/">
<base href="/admin/">
server.js

app.use('/', express.static('app', { redirect: false }));

app.get('/*', function(req, res){
    res.sendFile(__dirname + '/app/index.html');
});
如果路由中有额外的参数,我将得到以下错误


未捕获的SyntaxError:意外的令牌例如,问题在于express中间件

app.use(express.static('./build/'));
// Any invalid calls for templateUrls are under app/* and should return 404
app.use('/app/*', function(req, res, next) {
  four0four.send404(req, res);
});
// Any deep link calls should return index.html
app.use('/*', express.static('./build/index.html'));

找到解决方案

的位置正好在
之前,之前有所有的脚本和链接标签。在标题标签后添加
后,问题得到解决

http://localhost:8080/properties/
http://localhost:8080/properties/something
http://localhost:8080/pages/
http://localhost:8080/pages/editpages   
http://localhost:8080/properties
http://localhost:8080/pages
app.use(express.static('./build/'));
// Any invalid calls for templateUrls are under app/* and should return 404
app.use('/app/*', function(req, res, next) {
  four0four.send404(req, res);
});
// Any deep link calls should return index.html
app.use('/*', express.static('./build/index.html'));