ui-sref和可变状态参数名称 [英] ui-sref and variable state parameter names

查看:91
本文介绍了ui-sref和可变状态参数名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想呈现一个链接,例如:

I want to render a link such as:

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

其中状态名称myState和键myKey是变量.

where state name myState and key myKey are variables.

有没有办法做到这一点?

Is there a way to accomplish this?

推荐答案

我也遇到了同样的情况,我也无法完成,请尝试使用ng-click和ng-click内部移动代码函数使用 $ stage.go 并在其中传递参数,例如:

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});
}

这篇关于ui-sref和可变状态参数名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆