question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

url encode stateparams

See original GitHub issue

If i pass a string like /default to $stateParams, it seems to mess up the routing:

var name = "/default";
this.$state.go("app.transactions.detail", { txnName: name });

While the controller is invoked, the url is unable to switch to. when i encode the value before passing it to $stateparams, it works.

however, ui-router should take care of doing the encoding/decoding for me.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:68 (13 by maintainers)

github_iconTop GitHub Comments

11reactions
majew7commented, Sep 19, 2016

My issue may have been different, but I was happy to find :any in this discussion. I my code replaced url: 'products/{slugPath:.*}' with url: 'products/{slugPath:any}'

and I had success with finally seeing the forward slash when writing the slugPath rather than ~2F.

5reactions
christopherthielencommented, Sep 22, 2016

Also note we support non-encoded param types in 1.0, via raw: true

Here’s the docs 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Encode $stateParams on angular ui-router?
To encode a string in base64 format we use btoa() function and to decode the same encoded string we use atob() function. Example:...
Read more >
Developers - url encode stateparams -
Coming soon: A brand new website interface for an even better experience!
Read more >
Params.paramtypedefinition - UI-Router
Typed parameter definitions control how parameter values are encoded (to the URL) and decoded (from the URL). UI-Router always provides the decoded ...
Read more >
angular-ui-router - angularjs - query-parameters - url
Is there a way to update stateParams and sync it to the window URL? ... You only need to keep in mind to...
Read more >
angular-ui/ui-router
export let WORK_STATES: Ng2StateDeclaration[] = [ { name: 'app.work', url: '/work', redirectTo: 'app.work.welcome', views: { $default: { component: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found