Mr. Felix Mr. Felix - 7 days ago 5x
AngularJS Question

Angular ui-router pass parameter within the URL

I know I can pass parameters when changing pages like this:

$state.go('index.my_route', {my_param : value});


function myCtrl($stateParams) {

But I need this parameter at URL then I would like to know how can I pass it with the URL string and still calling
. Something like this:

$state.go('index.my_route?my_param=' + value);
> "http://localhost/#/index/my_route?my_param=123"


Your route should have url with query parameter.

.state('index.my_route', {
   url: '/index/my_route?my_param',

Now can call the state in the same way using $state.go with parameters.