How to delete '#' sign in angular-ui-router URLs

后端 未结 3 1460
旧巷少年郎
旧巷少年郎 2020-11-27 11:56

I\'m using the angular-ui-router library and I have a problem with URLs.

I have the following code:

app.js:

app.config(function ($stateProvid         


        
3条回答
  •  半阙折子戏
    2020-11-27 12:38

    If you are using Angular 1.6+, you will also need to remove the hashPrefix from the URL:

    appModule.config(['$locationProvider', function($locationProvider) {
      $locationProvider.hashPrefix(''); // by default '!'
      $locationProvider.html5Mode(true);
    }]);
    

    Don't forget to change the base as well:

    
        ...
        
    
    

提交回复
热议问题