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){

        }
    };

}]);

 

posted @ 2015-03-23 17:18  zyip  阅读(290)  评论(0编辑  收藏  举报