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.
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
Unless I'm misunderstanding your question, you can add target="_self"
to the link and angular won't try and route it.
Yes, target="_self" can be used for that, please look here:
http://docs.angularjs.org/guide/dev_guide.services.$location
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.
I don't think there's any other pragmatic way around this. @pixelcort you might look into transforming your html via response interceptors.
Most helpful comment
Unless I'm misunderstanding your question, you can add
target="_self"
to the link and angular won't try and route it.