以角度为单位传递$ location.path内的参数

时间:2016-12-12 12:55:11

标签: angularjs

我试着将参数传递给location.path,

 $http({
            method: 'POST',
            url: '../controller/subscriber.php',
            data: $scope.data, 
            headers: {'Content-Type': 'application/x-www-form-urlencoded'}
          })
            .success(function (data) {
                if (data.error === "false") {
                 $location.path("/group/detail/$routeParams.gId");
                }

            });

2 个答案:

答案 0 :(得分:2)

添加参数,你应该使用这个

 $location.path("/group/detail/"+$routeParams.gId);

答案 1 :(得分:2)

要添加参数,您应该使用$ location.search()方法:

$location.path('/myURL/').search({param: 'value'});

$location方法是可链接的。

这个产品:

/myURL/?param=value