Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript $http角度传递对象?_Javascript_Angularjs_Http - Fatal编程技术网

Javascript $http角度传递对象?

Javascript $http角度传递对象?,javascript,angularjs,http,Javascript,Angularjs,Http,您好,如何在Http中将此对象作为参数传递给angular? 因为我的wcg public void CreateNewAccount(用户为美国) 对于get,应使用参数: $http({method:'GET', url:'url', params:us}) 对于get,应使用参数: $http({method:'GET', url:'url', params:us}) 您需要将对象作为params传递到$http.get(url,config)方法的配置中 $http.get(app.

您好,如何在Http中将此对象作为参数传递给angular? 因为我的wcg public void CreateNewAccount(用户为美国)


对于
get
,应使用参数:

$http({method:'GET', url:'url', params:us})

对于
get
,应使用参数:

$http({method:'GET', url:'url', params:us})

您需要将对象作为
params
传递到
$http.get(url,config)
方法的配置中

$http.get(app.wcf + '/CreateNewAccount', {params: us})
  .then(function(resp){
     app.Logger(resp.data);
  },
  function(err){
    app.Logger(err);
})};

也就是说,您不应该以
GET
请求的形式传递此数据,尤其是在查询字符串中没有用户名和密码的情况下。

您需要将对象作为
params
传递到
$http.GET(url,config)
方法的配置中

$http.get(app.wcf + '/CreateNewAccount', {params: us})
  .then(function(resp){
     app.Logger(resp.data);
  },
  function(err){
    app.Logger(err);
})};

也就是说,您不应该将此数据作为
GET
请求传递,尤其是在查询字符串中没有用户名和密码的情况下。

我将此数据传递给调用选项
远程地址:192.168.58.182:80
请求URL:http://192.168.58.182/ESService/ESService.svc/CreateNewAccount
请求方法:选项
状态代码:405方法不允许
请求HeaderView源
接受:*/*
接受编码:gzip、deflate、sdch
接受语言:en-US,en;q=0.8,pl;q=0.6
访问控制请求头:接受,内容类型
访问控制请求方法:POST
连接:保持活力
主持人:192.168.58.182
来源:http://localhost:8100
推荐人:http://localhost:8100/
用户代理:Mozilla/5.0(Macintosh;英特尔Mac OS X 10_9_5)AppleWebKit/537.36(KHTML,如Gecko)Chrome/40.0.2214.93 Safari/537.36
响应头视图源
访问控制允许标头:内容类型,接受
访问控制允许方法:POST、GET、OPTIONS
访问控制允许来源:*
访问控制最大年龄:1728000
允许:邮寄
内容长度:1565
内容类型:text/html;字符集=UTF-8
日期:2015年1月30日星期五14:10:34 GMT
服务器:Microsoft IIS/7.5

X-Powered-By:ASP.NET

我得到了这个调用选项
远程地址:192.168.58.182:80
请求URL:http://192.168.58.182/ESService/ESService.svc/CreateNewAccount
请求方法:选项
状态代码:405方法不允许
请求HeaderView源
接受:*/*
接受编码:gzip、deflate、sdch
接受语言:en-US,en;q=0.8,pl;q=0.6
访问控制请求头:接受,内容类型
访问控制请求方法:POST
连接:保持活力
主持人:192.168.58.182
来源:http://localhost:8100
推荐人:http://localhost:8100/
用户代理:Mozilla/5.0(Macintosh;英特尔Mac OS X 10_9_5)AppleWebKit/537.36(KHTML,如Gecko)Chrome/40.0.2214.93 Safari/537.36
响应头视图源
访问控制允许标头:内容类型,接受
访问控制允许方法:POST、GET、OPTIONS
访问控制允许来源:*
访问控制最大年龄:1728000
允许:邮寄
内容长度:1565
内容类型:text/html;字符集=UTF-8
日期:2015年1月30日星期五14:10:34 GMT
服务器:Microsoft IIS/7.5

X-Powered-By:ASP.NET

为什么你要用这个做一个
$get
-它不应该是一个帖子吗?可能是但在wcf上它的get所以atm会得到如何发送这个对象或者$get不能?为什么你用这个做一个
$get
-它不应该是帖子吗?可能是但在wcf上它的get所以atm会得到如何发送这个对象或者$get无法?$http({method:'get',url:app.wcf+'/CreateNewAccount',params:us})。然后更正?:)如何使用数据制作post?:)如果要进行post,则为$http({method:'post',url:'url',data:us});你能看看为什么它不是POST而是选项吗?$http({method:'GET',url:app.wcf+'/CreateNewAccount',params:us})。然后更正?:)如何使用数据进行POST?:)如果你想做一个POST,那就是$http({method:'POST',url:'url',data:us});你能看看为什么不是POST而是选项吗?Thx:)只是测试新平台。Tom你能为POST请求修改这个吗?@Alex,
$http.POST(app.wcf+'/CreateNewAccount',us)。然后(…)
Thx:)只是测试新平台。Tom你能为POST请求修改这个吗?@Alex,
$http.POST(app.wcf+'/CreateNewAccount',us)。然后(…)