Closed
Description
Hi,
Since 1.0.0, when I'm going to a state, adding an optional query parameter and reloading the page, the query parameter disappears.
Here is an example, running with ui-router 0.2.18.
- go to #/?foo=bar
- the url is still #/?foo=bar
- the console output returns :
window.location.hash
equals#/?foo=bar
$location.url()
equals/?foo=bar
When switching to v1.0.0-alpha.4 :
- go to #/?foo=bar
- the url becomes #/
- the console output returns :
window.location.hash
equals#/?foo=bar
$location.url()
equals/
<!DOCTYPE html>
<html lang='fr' ng-app='app'>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.18/angular-ui-router.js"></script>
<script>
angular
.module('app', ['ui.router'])
.config(['$urlRouterProvider', '$stateProvider',
function ($urlRouterProvider, $stateProvider) {
$urlRouterProvider.otherwise("/");
$stateProvider.state('search', {
url: "/",
templateUrl: "/template.html",
controller: ['$location', function ($location) {
console.log(window.location.hash, $location.url())
}]
})
}
])
</script>
</head>
<body>
<div ui-view></div>
<script id='/template.html' type='text/ng-template'>
<div></div>
</script>
</body>
</html>