繁体   English   中英

我如何使用$ location.state()

[英]How do I use $location.state()

我想做相当于

windows.history.pushState({data: $scope.index}, "", "/winner");

$location.state({data: $scope.index})可以,但是不是我想要的。

$location.state({data: $scope.index}).path('/winner')

$location有一个path方法,该方法可以更改路径,因此可以执行$location.path('/winner') 它的方法也是可链接的,因此您可以如下组合状态和路径:

$location
  .state({data: $scope.index})
  .path('/winner')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM