angularjs post data

//post json 时收不到数据,目前只找到方法post form形式的key-value值

//关键是设置  headers: { 'Content-Type': 'application/x-www-form-urlencoded' }和data:'login=zyip@qq.com'

app.factory('googleBusiness', ['$window','$http', function(win,$http) {
    var document=win.document;
    return {
        getGoogleUserName:function(url,loginUser,successCallBack){
            var toUrl='/googlecfg/GetGoogleAccountByLoginName/';
            toUrl='http://localhost:7683/home/index';
            $http({
                url:toUrl,
                method: "POST",
                    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
                ,data:'login=zyip@qq.com'
            }).success(successCallBack);
        },
        saveGoogleUserName:function(loginUser,googleUserName){

        }
    };

}]);
原文地址:https://www.cnblogs.com/zyip/p/4360430.html