Reloading the page gives wrong GET request with AngularJS HTML5 mode

前端 未结 24 2976
慢半拍i
慢半拍i 2020-11-22 01:39

I want to enable HTML5 mode for my app. I have put the following code for the configuration, as shown here:

return app.config([\'$routeProvider\',\'$location         


        
24条回答
  •  鱼传尺愫
    2020-11-22 02:03

    Just write out a rule in web.config

    
      
        
        
          
          
            
            
            
          
          
        
           
        
    
    

    In the index add this

    
    

    it works for me maybe you've forgotten to set Html5Mode app.config

    app.config(function ($stateProvider, $urlRouterProvider, $locationProvider){
        $locationProvider.html5Mode({ enabled: true, requireBase: true });
        $locationProvider.hashPrefix('!');
    }
    

提交回复
热议问题