angular url is adding unwanted characters

前端 未结 3 1949
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-06 05:26

I had a project where the URL just worked fine when working locally by going to

localhost:9000/

the URL would become

相关标签:
3条回答
  • 2021-01-06 06:01

    Can confirm this to be a bug in Angular 1.6.0. Fixed my own same issue by reverting back to Angular 1.5.9.

    0 讨论(0)
  • 2021-01-06 06:04

    I have managed to solve this problem by using

    $locationProvider.hashPrefix('');
    

    It seems to be a bug in 1.6.0 angularjs

    0 讨论(0)
  • 2021-01-06 06:16

    This is actually not a bug.

    See commit-aa077e8

    The default hash-prefix used for $location hash-bang URLs has changed from the empty string ('') to the bang ('!').

    If you actually want to have no hash-prefix, then you can restore the previous behavior by adding a configuration block to your application:

    appModule.config(['$locationProvider', function($locationProvider) {
      $locationProvider.hashPrefix('');
    }]);
    
    0 讨论(0)
提交回复
热议问题