Conditionally have anchor links send user to a different page, rather than load to ng-view

前端 未结 1 477
清酒与你
清酒与你 2020-12-06 20:24

I have a view that contains an anchor link. That link has an href to another url in my site. Angular tries to load that site, using html5mode. I would rather just have de

1条回答
  •  一整个雨季
    2020-12-06 20:42

    AngularJS understands a few rules that will make the browser perform a full reload. The rules are documented under the 'Html link rewriting' section in the $location service documentation.

    From the documentation:

    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: link
    • Absolute links that go to a different domain Example: link
    • Links starting with '/' that lead to a different base path when base is defined Example: link

    Note that the last example only works if you have used the base element in the head section of your page:

    
    

    0 讨论(0)
提交回复
热议问题