$ state.go toParams不会传递到$ stateParams [英] $state.go toParams not passed to $stateParams
问题描述
我使用AngularJS V1.2.0-rc.2与UI的路由器v0.2.0。我想引荐状态传递到另一种状态,所以我使用 toParams
$ state.go
像这样的:
I am using AngularJS v1.2.0-rc.2 with ui-router v0.2.0. I want to pass the referrer state to another state so I use the toParams
of $state.go
like so:
$state.go('toState', {referer: $state.current.name});
根据<一href=\"https://github.com/angular-ui/ui-router/wiki/Quick-Reference#stategoto--toparams--options\">docs,这应该填充 $ stateParams
的 toState
控制器上,但它是未定义
。我缺少什么?
According to the docs, this should populate the $stateParams
on the toState
controller, but it is undefined
. What am I missing?
我创建了一个普拉克来演示:
I've created a plunk to demonstrate:
推荐答案
我所要做的就是一个参数添加到像这样的URL状态定义
All I had to do was add a parameter to the url state definition like so
url: '/toState?referer'
卫生署!
这篇关于$ state.go toParams不会传递到$ stateParams的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!