我已在我的应用程序中将 html5Mode 设置为true
。我的路线定义如下:
app.config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
$routeProvider.
when('/api/', {
templateUrl: '../../html/console.html',
controller: 'paramsController'
}).
when('/', {
templateUrl: '../../html/timeline.html',
controller: 'timelineController'
}).
otherwise({
redirectTo: '/'
});
}]);
但是每当我发出请求时,http://localhost:3000/api
它会发出 HTTP 调用并且请求会转到服务器而不是解析到我的角度路由。
我需要在这里照顾什么。
我的主页添加了以下标签:
<base href="/">
只是说明一下,以防它在这里改变任何东西。是否需要其他配置。我node.js
作为服务器使用express.js
.