我有一个HTLM表,其中包含有关人员(id,name,..)的信息。我将该名称作为另一页的链接,因此当我按任何人的名字时,我想将此人的身份证传递给另一个PHP页面以使用它。 下面是我的代码:如何使用Angular控制器将变量传递给另一个页面?
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>
控制器:
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';
}
});
第二页,我想ID传递给:
<?php
$data = json_decode(file_get_contents("php://input"));
echo $data->id;
?>
当我点击任何按钮,第二页说:
“注意:试图获得非物件的财产”
任何关于什么是错的?
谢谢。
你的意思是另一个部分? –