标签:var cat urlencode use enc view data als return
POST 请求传参
$http({
method: "POST",
url: url,
data: {
"role_id": 1,
"telephone": $scope.setData.telephone,
"user_pwd": $scope.setData.user_pwd
},
headers: { ‘Content-Type‘: ‘application/x-www-form-urlencoded‘ },
transformRequest: function(obj) {
var str = [];
for (var s in obj) {
str.push(encodeURIComponent(s) + "=" + encodeURIComponent(obj[s]));
}
return str.join("&");
}
}).then(function (res) {});
GET请求传参
$http({ method: "get", params:{id:1,name:jyy}, url:"1.php" })
http://blog.csdn.net/gufeilong/article/details/53584967
页面传参
传递单个参数
要在目标页面定义接受的参数:
.state("project-complaint",{
url:‘/project-complaint‘,
params:{"id":null},
views: {
‘main‘: {
templateUrl: ‘view/project-complaint.html‘,
controller: ‘project-complaintCtrl‘
}
},
cache:false
})
//工程投诉
$scope.complaint = function (item) {
$state.go("project-complaint", {id: item.order_number});
};
接收参数
console.log( $stateParams.id)
传递对象
.state("project-complaint",{
url:‘/project-complaint/:object‘,
views: {
‘main‘: {
templateUrl: ‘view/project-complaint.html‘,
controller: ‘project-complaintCtrl‘
}
},
cache:false
})
$state.go("app.example2", {object: JSON.stringify(obj)});
接收参数
console.log(JSON.parse($state.params.object));
http://blog.csdn.net/qq_dai/article/details/52869866
标签:var cat urlencode use enc view data als return
原文地址:http://www.cnblogs.com/xyc211/p/7452676.html