如何使用Angular控制器将变量传递给另一个页面?

I have a HTLM table that contains information about persons ( id,name,..). I made the name act as a link to another page, so when I press the name of any person I want to pass the id of this person to another php page to work with it. Below is my code:

HTML:

<tr ng-repeat="x in data | filter:search:restrict">
    <td>{{ x.id }}</td>
    <td><button  ng-controller ="direct" class="btn btn-link" ng-click = "sendID(x.id)">{{ x.name }}</button></td>

controller :

fetch.controller('direct',function($scope,$http,$window){
        $scope.sendID=function(){
        $http.post("here.php",{'id':$scope.id})
                .success(function(headers,config){
                });
        $window.location.href = '/here.php'; 
    }

});

The second page, which I want to pass the id to:

<?php

$data = json_decode(file_get_contents("php://input"));

echo $data->id;

?>

When I click any button, the second page says:

"Notice: Trying to get property of non-object"

Any idea about what is wrong?!

Thank you.

May be pass id through href:

$window.location.href = '/here.php?id=' + $scope.id; 

PHP

<?php
  $id = $_GET['id'];
  echo $id;
?>

if you just wanted it to be accessed in next page pass it as query string else save the value in $rootscope so that it can be accessed from any controller