Removing the fragment identifier from AngularJS urls (# symbol)

后端 未结 14 2011
Happy的楠姐
Happy的楠姐 2020-11-22 00:01

Is it possible to remove the # symbol from angular.js URLs?

I still want to be able to use the browser\'s back button, etc, when I change the view and will update th

14条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 00:42

    I write out a rule in web.config after $locationProvider.html5Mode(true) is set in app.js.

    Hope, helps someone out.

      
        
          
            
              
              
                
                
                
              
              
            
          
        
      
    

    In my index.html I added this to

    
    

    Don't forget to install url rewriter for iis on server.

    Also if you use Web Api and IIS, this match url will not work out, as it will change your api calls. So add third input(third line of condition) and give out a pattern that will exclude calls from www.yourdomain.com/api

提交回复
热议问题