$stateParams not decodeURIComponent @v0.2.15
my router looks like this:
'app.external': {
url: "/external/{url:.*}",
views: {
'screen': {
controller: function($scope, $state, $stateParams) {
if (!$state.params.url) {
$state.go('app.external', {
url: 'http://www.1688.com/'
});
return;
}
console.log($stateParams); // {url: "http:%2F%2Fwww.1688.com%2F"}
}
}
}
}
while, the param $stateParams equals {url: "http:%2F%2Fwww.1688.com%2F"}
when debugging through angular-ui-router.js, I found that both $state.go() and handleIfMatch() (line L2346 ) invoke the $state.transitionTo again, but the var toParams are not the same.
but when I change the param url to an other string such as 阿里巴巴, www.1688.com, I works.
BTW: version v0.2.13 performs well.
I'm experiencing this problem also.
Can confirm that v0.2.13 performs fine.
I found that I was able to get some logging on it:
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
// console.log("from:", fromState.name);
// console.log(JSON.stringify(fromParams, null, " "));
// console.log("to:", toState.name);
// console.log(JSON.stringify(toParams, null, " "));
});
Any time I navigated to a state, $stateChangeStart would get fired twice — once with a URI-decoded version of the state, and once with a URI-encoded version of the same state.
Wondering what changed in (v0.2.14? v0.2.15?) that could account for this.
See also: https://github.com/angular-ui/ui-router/issues/2172
pretty sure this is a duplicate of params encoding issue.
+1. I put a normal url in, and get an encoded url out. Not useful.