Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I need to update path with search params but I don't know before running http request the values for this param. This tags param can be different for all users.

That's why I can't set this name to url of angular-ui-router. I know 2 options which I can try:

1) use angular-ui-router features only url: '/path/:user?{tags:json}', params: { tags: null} }

And set tags with $state.go('mystate', angular.toJson(tagsParamObject))

In such case I will get URL string as path?tags=%7B"salesperson":%5B"Operator%201"%5D,"Unknown":%5B"dresses"%5D%7D and read them via $stateParams

2) Use $location.href with custom mapping and encoding approach: $location.url($location.path() + '?' + tagsParamObject); read params via $location.search() and remap them again

I prefer the 2nd approch format but I read a lot of posts which state that usage of $location instead of manipulating state params can cause problems.

Is it possible to achieve format url from 2nd variants using just state approach? Or does it exist other good variant?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.