Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Option to disable capturing <a href="..."> links #5195

Closed
pixelcort opened this issue Nov 29, 2013 · 5 comments
Closed

Option to disable capturing <a href="..."> links #5195

pixelcort opened this issue Nov 29, 2013 · 5 comments

Comments

@pixelcort
Copy link

Angular should have an option to ignore <a href="..."> links and allow the browser to handle them natively.

I've got HTML I display that I get from an API. In it I have <a href="..."> links I want to behave natively, causing full page reloads. And then I use ng-href for the stuff I want to go through the $router, etc.

@caitp
Copy link
Contributor

caitp commented Nov 29, 2013

the thing is, ngRoute doesn't (and can't) really work like that. it's not "capturing links", it's essentially watching window.location --- so how would you force it to disable the updateRoute function temporarily? It might be doable but I'm not entirely sure how it would work

@Substr
Copy link

Substr commented Dec 4, 2013

Unless I'm misunderstanding your question, you can add target="_self" to the link and angular won't try and route it.

@filso
Copy link

filso commented Dec 7, 2013

Yes, target="_self" can be used for that, please look here:

http://docs.angularjs.org/guide/dev_guide.services.$location

@pixelcort
Copy link
Author

Yeah I know about target="_self", but this HTML is coming down from an API.

I guess I could parse it and add target="_self" myself as a workaround.

@btford
Copy link
Contributor

btford commented Dec 20, 2013

I don't think there's any other pragmatic way around this. @pixelcort you might look into transforming your html via response interceptors.

@btford btford closed this as completed Dec 20, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants