嗨,我正在使用Mean堆栈的Web应用程序问题是包含#的网址!
就像是
http://host:3000/#!/signup
我希望网址像
http://host:3000/signup
这该怎么做。
在$routeProvider
中,使用HTML5 History API:
$ locationProvider.html5Mode(真);
设置相关链接:
要使用相对链接链接您的应用程序,您需要在文档的<base>
中设置<head>
。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<base href="/">
</head>
你可以在这里详细阅读:Pretty URLs in AngularJS: Removing the #
希望这可以帮助。
通过添加以下代码为$locationProvider
启用HTML5
$locationProvider.html5Mode(true).hashPrefix('!');