• angualr $http 页面传参问题


    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
  • 相关阅读:
    一个数组找出第k大的数(待补)
    变动二叉树
    判断一个二叉树
    Redis的过期策略和内存淘汰机制
    sql连接详解
    http 请求和格式
    java基础知识
    分页信息
    持续集成之Jenkins自动部署war包到远程服务器
    no-sql数据库之redis
  • 原文地址:https://www.cnblogs.com/xyc211/p/7452676.html
Copyright © 2020-2023  润新知