AngularJs ui-router $ location还是$ state? [英] AngularJs ui-router $location or $state?
本文介绍了AngularJs ui-router $ location还是$ state?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何改变这一点:
$location.path('/app/home/' + id).search({x:y});
到此:
$state.go('/app/home/' + id).search({x:y});
我试过,但实际上我无法获得足够的信息如何实现...
I tried, but I actually can't get enough information how to achieve that...
推荐答案
有很好的文档(虽然已弃用,但仍非常清楚):
假设州
定义如下所示:
.state('app', { // parent app
url: '/app',
...
})
.state('app.home', {
url: '/home/:x', // the param named x
...
然后你会做
$state.go('app.home', {x:y});
此Q& A也有帮助:
This Q&A could help as well:
- Angular ui-router - how to access parameters in nested, named view, passed from the parent template?
这篇关于AngularJs ui-router $ location还是$ state?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文