How to set root location for AngularJS router?

前端 未结 2 756
孤街浪徒
孤街浪徒 2020-12-20 17:58

I would like to start navigation from http://mysite.com/hello/world, not from site root.

e.g.

$ro         


        
相关标签:
2条回答
  • 2020-12-20 18:05

    Add base tag to the main HTML file that is being served when user navigates to http://example.com/hello/world:

    <base href="/hello/world/" />
    

    More info can be found at Developer Guide / Using $location

    0 讨论(0)
  • 2020-12-20 18:11

    Adding a basetag also creates issue, double time gets appended.

    By adding a (.) for root, in template url as below: templateUrl: './mytmpl.html' - resolves the issue

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