【发布时间】:2016-03-03 17:55:49
【问题描述】:
我有一个 HTLM 表,其中包含有关人员的信息(id、name、..)。我把这个名字作为另一个页面的链接,所以当我按下任何人的名字时,我想把这个人的 id 传递给另一个 php 页面以使用它。 以下是我的代码:
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;
?>
当我点击任何按钮时,第二页显示:
“注意:试图获取非对象的属性”
知道什么是错的吗?!
谢谢。
【问题讨论】:
-
你的意思是另一个部分??
标签: javascript php html angularjs angular-controller