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
时间: 2024-10-12 06:10:24