在角传递$ location.path内部参数 [英] Passing parameter inside $location.path in Angular
本文介绍了在角传递$ location.path内部参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想在我的控制器使用 $ location.path()
也通过自定义变量作为参数。因此,这将是这个样子我想:
I'm just trying to use $location.path()
in my controller but also passing a custom variable as a parameter. So it would look something like this I guess:
$scope.parameter = 'Foo';
$location.path('/myURL/' + $scope.parameter);
但是,这并不工作。任何人都知道这是怎么认为的角度做?
But that doesn't work. Anyone know how this is supposed to be done in Angular?
推荐答案
添加参数,你应该使用 $ location.search()
方法,以便:
to add Parameters you should use $location.search()
method so:
$location.path('/myURL/').search({param: 'value'});
$位置
方法的链式的
本产品:
/myURL/?param=value
这篇关于在角传递$ location.path内部参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文