我有两页。第一页显示数据使用ng-repeat call item.html,第二页我显示了item的详细信息,call details.html。第一页还可以,但第二页有问题,这是我的代码
item.html
<tr ng-repeat="data in vm.mydata">
<a ui-sref="details({param:data.masp})"
ng-click="vm.details(data.masp)">
<td>{{data.masp}}</td></a>
</tr
这是我的配置路线
.state('details',{
url:'/details/{param}',
templateUrl:'/project/app/client/details/details.html',
controller:'shopController',
controllerAs:'vm'
})
这是我的php
//connect db
$data =array();
$masp = isset($_POST['masp'])? trim($_POST['masp']) :'';
$sql ="SELECT *FROM sanpham WHERE masp='$masp'";
$result = mysqli_query($conn,$sql);
while($r = mysqli_fetch_assoc($result)){
$r['masp'] =$data['masp'];
}
print json_encode($data);
这是我的控制器
vm.details = function(ismasp){
$http({
method :'POST',
url:'/project/app/server/action/details.php',
data:$.param({'masp':ismasp}),
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(success);
function success(response){
vm.masp = response.data.masp;}
这里是detail.html
{{vm.masp}}
但它没有显示,我的错在哪里。请帮助我 。提前谢谢