绕过Angular URL路由 [英] Bypassing Angular URL routing

查看:56
本文介绍了绕过Angular URL路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何绕过angular提供的路由?例如,在我的角度路由设置中,我设置了 $ routeProvider.otherwise({redirectTo:'/ someurl'});

How do I bypass the routing provided by angular? For instance, in my angular routing settings, I have set $routeProvider.otherwise({redirectTo : '/someurl'});.

我想要一个特定的请求(由用户点击HTML中的某个链接生成)转到我的网络服务器而不是重定向到Angular的 / someurl 路由。我该怎么做?

I want a certain request (generated by the user clicking a certain link in the HTML) to go to my webserver and not redirected to /someurl by Angular's routing. How do I do this?

推荐答案

来自 $ location docs


如下所示,链接不会被重写;相反,
浏览器将对原始链接执行整页重新加载。

In cases like the following, links are not rewritten; instead, the browser will perform a full page reload to the original link.

包含目标元素的链接。示例:< a href =/ ext / link?a = b
target =_ self> link< / a>

Links that contain target element. Example: <a href="/ext/link?a=b" target="_self">link</a>

转到其他域的绝对链接。示例:< a href =http://angularjs.org/> link< / a>

Absolute links that go to a different domain. Example: <a href="http://angularjs.org/">link</a>

以'/'开头的链接,在定义base时会导致不同的基本路径。示例:
< a href =/ not-my-base / link> link< / a>

Links starting with '/' that lead to a different base path when base is defined. Example: <a href="/not-my-base/link">link</a>

这篇关于绕过Angular URL路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆