使用AngularJSHTML 5模式重新加载页面会产生错误的GET请求
return app.config(['$routeProvider','$locationProvider', function($routeProvider,$locationProvider) { $locationProvider.html5Mode(true); $locationProvider.hashPrefix = '!'; $routeProvider.when('/', { templateUrl: '/views/index.html', controller: 'indexCtrl' }); $routeProvider.when('/about',{ templateUrl: '/views/about.html', controller: 'AboutCtrl' });
$locationProvider.html5mode
ng-href
/#/
.
localhost:9000/
localhost:9000/about
.
localhost:9000/about
Cannot GET /about
Request URL:localhost:9000/aboutRequest Method:GET
localhost:9000/
/about
Request URL:http://localhost:9000/views/about.html
当我刷新时,如何启用角获取正确的页面?
慕桂英3389331