In our Angular app we have to deal with id's that contain a "dot". For example:
book = {
id: '123.456'
}
We have problems using such id's as url parameters. All works well if navigation occurs through "Angular", namely clicking on the link that invokes $state.go('bookDetails', {bookId: book.id});
. But things do not work when reloading the page
"Cannot GET /bookDetails?bookId=123.456"
in the controller:
$scope.viewBookDetails = function() {
$state.go('bookDetails', {bookId: book.id});
}
in the view
<a href="" ng-click="viewBookDetails(); $event.stopPropagation();">
in the router:
.state('bookDetails', {
url: '/bookDetails?bookId'
}
in the browser:
https://example.com/bookDetails?bookId=123.456
The link works if the "dot" is replaced with %2E
in the browser.
We tried to replace "dot" with "%2E" in the parameter for $state.go()
$scope.viewBookDetails = function() {
$state.go('bookDetails', {bookId: book.id.split('.').join('%2E')});
}
but does not work because the "%" is automatically encoded and the "dot" in the browser is replaced by "%252E"
https://example.com/bookDetails?bookId=123%252E456