我有一个网址,格式如下所示:传递参数到角location.search
www.mydomain.co.uk/ui/#/index?status=111?cart=5555
我明白,如果我做的:
var status = $location.search().status;
var cart = $location.search().cart;
我能得到的状态和车的价值,但我想.search()
一个参数,我通过在后,例如,使值:
function getParameters(param) {
return $location.search() + param;
}
$scope.status = getParamter(status);
$scope.cart = getParamter(cart);
然而,当我TR y编译我的JavaScript,该过程在我的函数return语句失败。
为什么不只是使用'$ routeParams.status'和'$ routeParams.cart'? '$ location.search()'不是最优的,恕我直言。 https://docs.angularjs.org/api/ngRoute/service/$routeParams#!/ – Claies
@Claies - 即时通讯使用ui路由器,有没有相当于ui路由器? –
'ui-router'有'$ stateParams' – Claies