AngularJS slash after hashbang gets encoded

前端 未结 1 1877
星月不相逢
星月不相逢 2021-01-22 06:46

I\'ve configured AngularJS locationProvider to use html5 (and fallbacks in hashbangs)

$locationProvider.html5Mode(true).hashPrefix(\'!\')

The p

相关标签:
1条回答
  • 2021-01-22 07:40

    This may help: angular-slash-gets-encoded

    I solved it by doing two things:

    1. I added <base href="/"> to index.html.
    2. I activated HTML5 mode but without prefix.

    This way I can use either http://localhost/#!/route or http://localhost/route and the URL gets rewritten correctly.

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