ui-sref and variable state parameter names

Issue

I want to render a link such as:

<a ui-sref="myState({myKey: 'my variable type value'})">

where state name myState and key myKey are variables.

Is there a way to accomplish this?

Solution

I found myself in the same situation, I couldn’t acomplish that as well, try to move your code using ng-click and inside of your ng-click function use a $stage.go and pass the parameters there, something like:

$scope.clickHandler = function(param){
    $state.go('state.name',{myKey:param});
}

Answered By – pedrommuller

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.