Angular html5 平均堆栈模式
Angular html5 mode in Mean stack
routes.js
app.route('/*')
.get(indexController.render);
indexController.js
exports.render=function(req, res){
res.render('index');
}
config.js
$locationProvider.html5Mode(true);
我正在尝试在我的平均应用程序中实施 html5 模式。这没有用。这有什么不妥
exports.render=function(req, res){
//Your path to the html with .html
res.render('index.html');
}
在索引页中,你应该这样写:
<base href="/">
帮助 html5mode。
为了确保 angular 可以在没有散列爆炸的情况下处理您的路由 url (#/),您必须将此代码添加到您的主 index.html
:
<base href="/">
这是为了确保 angular 知道此页面是主页,并且应在此页面中动态填充路由。
routes.js
app.route('/*')
.get(indexController.render);
indexController.js
exports.render=function(req, res){
res.render('index');
}
config.js
$locationProvider.html5Mode(true);
我正在尝试在我的平均应用程序中实施 html5 模式。这没有用。这有什么不妥
exports.render=function(req, res){
//Your path to the html with .html
res.render('index.html');
}
在索引页中,你应该这样写:
<base href="/">
帮助 html5mode。
为了确保 angular 可以在没有散列爆炸的情况下处理您的路由 url (#/),您必须将此代码添加到您的主 index.html
:
<base href="/">
这是为了确保 angular 知道此页面是主页,并且应在此页面中动态填充路由。