我正在使用状态提供商,并通过使用locationProvider并在索引文件中添加了BSE标签启用了HTML5。但这不起作用。
与$ locationprovider配置您的应用:
function config($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(true);
// Routes
}
和html:
<!DOCTYPE html>
<html>
<head>
<base href="/">
</head>
hashprefix删除'!'
来源:https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag