Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$stateParams not decodeURIComponent @v0.2.15 #2102

Closed
mycoin opened this issue Jul 16, 2015 · 4 comments
Closed

$stateParams not decodeURIComponent @v0.2.15 #2102

mycoin opened this issue Jul 16, 2015 · 4 comments

Comments

@mycoin
Copy link

mycoin commented Jul 16, 2015

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.

@billforward-alex
Copy link

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.

@quoideneuf
Copy link

See also: #2172

@eddiemonge
Copy link
Contributor

pretty sure this is a duplicate of params encoding issue.

@michaelabuckley
Copy link

+1. I put a normal url in, and get an encoded url out. Not useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants