当前页面是一个list,点击某一条数据,跳转到另一个页面查看这条数据的详细内容。问题是:在当前页面可以获取到数据,不知为啥跳转到另一个页面后就没有获取到数据?
list页面
<table ng-repeat="product in item.products">
<tr>
<td class="tw_35">
<div class="picMsg" >
<img src="" /><p>{{product.name}}</p><p>型号:{{product.price}} 颜色:{{item.color}}</p>
</div>
</td>
<td>
<span><a class="color0" ng-click="itemdetail (item.ocode)">详情</a></span>
</td>
</tr>
</table>
list事件:
$scope.itemdetail = function(id){
// alert(id)
$state.go('itemdetailpage', {id: id});
$scope.detailsss = [];
//发送字段
var detailoption = {'uid':1,'id':id}
//
var json ={
"service":"服务路径",
"reqData":detailoption
};
//post
$http({
method : 'POST',
url : posturl,
data: json,
header:headers
}).success(function(data) {
$scope.detailsss = data.respData;
}).error(function(data){
console.log(data.msg);
})
}
另一个页面-详情页:
<div ng-repeat="d in detailsss ">
{{d}}
</div>
把接收数据的数组的$scope改成了$rootScope