Angularjs Normal Links with html5Mode

前端 未结 4 1056
忘了有多久
忘了有多久 2020-11-28 03:46

I am working with angularjs in html 5 mode. Which appears to take control of all href\'s on the page. But what if I want to have a link to something within the same domain o

4条回答
  •  一向
    一向 (楼主)
    2020-11-28 04:16

    As of Angular v1.3.0 there is a new rewriteLinks configuration option for the location provider. This switches "hijacking" all the links on the page off:

    module.config(function ($locationProvider) {
        $locationProvider.html5Mode({
            enabled: true,
            rewriteLinks: false
        });
    });
    

    While disablig this behavior for all links may not be your intention, I'm posting this for others who, like me, want to use $location in html5 mode only to change the URL without affecting all links.

提交回复
热议问题