5

How do I bypass the routing provided by angular? For instance, in my angular routing settings, I have set $routeProvider.otherwise({redirectTo : '/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?

1 Answer 1

5

From the $location docs:

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

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

Absolute links that go to a different domain. Example: <a href="http://angularjs.org/">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>

Sign up to request clarification or add additional context in comments.

3 Comments

I've tried this. If I open the links in a new tab, it works fine. But if I click on the link directly, angular's routing takes over, none the less.
You should create a plunker. Here's a template.
The problem occurs only when the html5 mode is set to true. With the # based url scheme, it works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.