ui-sref和变量状态参数名称

Yan*_*nis 5 angularjs angular-ui-router

我想渲染一个链接,如:

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

其中state name myState和key myKey是变量.

有没有办法实现这个目标?

jac*_*per 7

我发现自己处于相同的情况,我也无法完成这一点,尝试使用ng-click移动你的代码并在你的ng-click函数内部使用$ stage.go并在那里传递参数,例如:

$scope.clickHandler = function(param){
    $state.go('state.name',{myKey:param});
}
Run Code Online (Sandbox Code Playgroud)

  • ui-router目前不支持动态ui-srefs.https://github.com/angular-ui/ui-router/issues/395 (2认同)