Removing # from url in Angularjs while having .run in routes

后端 未结 7 668
感情败类
感情败类 2020-11-27 07:02

Here is my app.js route file in AngularJS

var app = angular.module(\'myApp\', [\'ngRoute\', \'ngAnimate\', \'toaster\']);
app.config([\'$routeP         


        
7条回答
  •  忘掉有多难
    2020-11-27 07:19

    it does not look possible you to remove hash-bang (#) from href manually, and it causes malfunction your router because hashbangs are enables browser not treat your state in order to send get request to an end point. browser does not fire a get request over #/route while it does over /route, unless you use your url provider in html5 mode. For html5 mode, add the line below into your app.config function:

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

提交回复
热议问题