Rwin
Rwin

Reputation: 133

Pass parameter inside $location.path in angular

im just tryin to pass a parametr into 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");
                }

            });

Upvotes: 2

Views: 1076

Answers (2)

pouria_ghanbari
pouria_ghanbari

Reputation: 21

to add Parameters you should use $location.search() method so:

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

$location methods are chainable.

this produce :

/myURL/?param=value

Upvotes: 2

Yaser Darzi
Yaser Darzi

Reputation: 1478

to add Parameters you should use this

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

Upvotes: 2

Related Questions