Why Angular UI router in my simple example encode slashes in url if I mannually trigger state change (with $state.go(toState, toParams)).
$rootScope.$on("$stateChangeStart", function (event, toState, toParams, fromState, fromParams, error) {
console.log("stateChangeStart");
$rootScope.loading = true;
if(!isLoggedIn) {
event.preventDefault();
Api.get().then(function(response){
isLoggedIn = response;
$state.go(toState, toParams);
});
}
});
Here is full example. http://plnkr.co/1mSXJbN1PMrFiG72oa9m
For example url like: /template1 is encoded to %252Ftemplate1. Otherwise state is also encoded.
This is really weird, how i can disable that?
In $stateChangeStart event I simulate server side user authentication. Another part of this question is how i can treat url /template1 same as /template1/ in this concrete example?
P.S. I shut down html5 mode since it needs a properly configured server (for testing (bug?) in this example html5 mode is required).
Tnx