url encode stateparams
See original GitHub issueIf 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:
- Created 9 years ago
- Comments:68 (13 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My issue may have been different, but I was happy to find
:any
in this discussion. I my code replacedurl: 'products/{slugPath:.*}'
withurl: 'products/{slugPath:any}'
and I had success with finally seeing the forward slash when writing the slugPath rather than
~2F
.Also note we support non-encoded param types in 1.0, via
raw: true
Here’s the docs 😉