angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

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

Open pixelcort opened this issue 13 years ago • 5 comments

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.

pixelcort avatar Nov 29 '13 06:11 pixelcort

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

caitp avatar Nov 29 '13 06:11 caitp

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

Substr avatar Dec 04 '13 13:12 Substr

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

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

filso avatar Dec 07 '13 00:12 filso

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.

pixelcort avatar Dec 10 '13 04:12 pixelcort

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

btford avatar Dec 20 '13 00:12 btford