1

On button click I am redirecting to another page using state.go(). the code is

$scope.usercal = function(x,y,z){
        $state.go('app.calendar',{employeeName:x,employeeID:y,projectName:z});
}

I want to do the same with `$location.path(/url);

But how to pass the parameters?

1

3 Answers 3

0

hi to pass Parameters for $location.path you should use $location.search() like this:

$location.path('/myURL/').search({param: 'value'});

This will lead to

/myURL/?param=value
Sign up to request clarification or add additional context in comments.

Comments

0

If your parameters are the part of url (path) only than you can use

$location.path('/myURL/'+x+'/'+y);

if parameter is query string then go with

$location.path('/myURL/').search({employeeName: x});

Comments

0

We use ngRoute, which operates slightly differently than ui-router.

$stateParams in ui-router is converted to $routeParams, which can contain values in the same way, and is populated using url's as usual like so:

some/path/:a/to/dir/:b results in the params to the resulting page be {a, b}.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.