I am trying to understand how to remove #! from the url in angularjs using ng-route . Can please someone help me with the exact steps I need to follow in order to remove #!.
Here is the code
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>"
})
}]);
My requirement is when click on click me link it should display
It's routing template.
But when browser loads index.html the url is coming as
http://localhost:3000/index.html#!/
and when I click on Click Me link the url is coming as
http://localhost:3000/index.html#!/#test
I want this url and link to be work without #!.