I am trying to implement a single page application with AngularJS 1.6.0-rc.2, and it keeps formatting a forward slash to its escape code %2F in my URL. Because of that it gets not detected by the route.
I have read about hashbangs and tried fixing it by setting the HTML5 mode on, but the url keeps getting converted.
Questions
1 - Why Angular has to do such a thing, what's the purpose of making this conversion?
2 - I noticed version 1.3 doesn't do that. Should I be using this version instead?
3 - How to fix it?
More Details
I have 3 pages and 1 javascript file
- index.htm
- home.htm
- forecast.htm
- app.js
Here's some part of app.js that I believe might be relevant:
$routeProvider
.when('/', {
templateUrl: 'pages/home.htm',
controller: 'homeController'
})
.when('/forecast', {
templateUrl: 'pages/forecast.htm',
controller: 'forecastController'
})
My index.htm has my ng-view
And part of home.htm:
<a href="#/forecast" class="btn btn-primary">Get Forecast</a>
So when the link 'Get Forecast' is clicked, the URL I get is this:
http://127.0.0.1:65381/index.htm#!/#%2Fforecast
That means, that URL doesn't match the route then I still have my home.htm content instead of forecast.htm