如何设置路由器AngularJS根位置? [英] How to set root location for AngularJS router?
本文介绍了如何设置路由器AngularJS根位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从 http://mysite.com/hello/world
开始导航,而不是从网站根目录。
I would like to start navigation from http://mysite.com/hello/world
, not from site root.
例如
$routeProvider
.when('/myurl', {
templateUrl: 'mytmpl.html',
controller: 'MyCtrl'
});
在我的网址应该反应 http://mysite.com/hello/world/myurl
我怎么能这样做?
推荐答案
基础标签添加到正在当用户浏览到 http://example.com/hello/world服务的主HTML文件
:
Add base tag to the main HTML file that is being served when user navigates to http://example.com/hello/world
:
<base href="/hello/world/" />
更多信息可以在开发者指南中找到/使用$地点
这篇关于如何设置路由器AngularJS根位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文