0
我想了解如何删除#!从使用ng-route的angularjs中的url中获取。 可以请别人帮助我完成我需要遵循的确切步骤,以便删除#!.删除#!从URL在angularjs
下面是代码
的index.html
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
<script src="a02.js"></script>
</head>
<body ng-app="testApp">
Hello there
<hr>
<a href="#test">Click Me </a>
<div ng-view></div>
</body>
</html>
a02.js
var app = angular.module("testApp", ['ngRoute']);
app.config(["$routeProvider",function($routeProvider){
$routeProvider.when('/test',{
template:"<strong>It's routing template</strong>"
})
}]);
我的要求是,当点击点击我连结它应该显示
它是路由模板。
但是,当浏览器加载index.html中的网址即将为
http://localhost:3000/index.html#!/
,当我点击点击我的链接的URL为即将到来的
http://localhost:3000/index.html#!/#test
我希望这个网址和链接工作没有#!.
在你的js文件路由器