加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – ngRoute设置所有路由的基本URL

发布时间:2020-12-17 08:56:48 所属栏目:安全 来源:网络整理
导读:是否可以在AngularJS应用程序的所有路由中添加基本URL?基本上改变它在服务器上的位置(种类,如果这是有意义的,所以它将被访问不通过’/’但通过’/ something /’)。 为了添加一些上下文,我试图放置一个现有的Angular应用程序背后一些身份验证,使应用程
是否可以在AngularJS应用程序的所有路由中添加基本URL?基本上改变它在服务器上的位置(种类,如果这是有意义的,所以它将被访问不通过’/’但通过’/ something /’)。

为了添加一些上下文,我试图放置一个现有的Angular应用程序背后一些身份验证,使应用程序现在将访问地址说成功登录后http:// mysite / secure。

问题是如果我加载应用程序在http:// mysite / secure它工作正常(服务器显然会提供正确的页面),但单击任何链接将导致页面重新加载并路由到http:// mysite /#newpage而不是http:// mysite / secure /#newpage。

没有添加/安全/到所有的路由和链路元素是可能的?干杯,对不起,如果这不是写得好。

设置< base> HTML5标记可能有所帮助。从文档 here:

Relative links

Be sure to check all relative links,images,scripts etc. You must either specify the url base in the head of your main html file (<base href="/my-base">) or you must use absolute urls (starting with /) everywhere because relative urls will be resolved to absolute urls using the initial absolute url of the document,which is often different from the root of the application.

Running Angular apps with the History API enabled from document root is strongly encouraged as it takes care of all relative link issues.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读