Angularjs以REST风格Web服务连接如 [英] Angularjs to restfull webservices conection

查看:108
本文介绍了Angularjs以REST风格Web服务连接如的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已创建了一个Web服务REST风格(例如:的http://本地主机:8080 / RestfulAndAngularJS_Server /休息/产品/的findall )我试图用angularjs来连接REST风格的Web服务,但我正在逐渐衰竭。

我的样本code是

<$p$p><$c$c>$http.get('http://localhost:8080/RestfulAndAngularJS_Server/rest/product/findall').success(function(response){
  $ window.alert(成功)
})错误(功能(数据,状态,头,配置){
  $ window.alert(失败)
});

我要为这个解决方案,立即请发邮件我,如果任何一个有答案,或者样品code。


解决方案

有关角的$资源文档。

i have created one restfull webservice (ex:http://localhost:8080/RestfulAndAngularJS_Server/rest/product/findall) i am trying to connect that restfull web service using angularjs but i am getting failure

my sample code is

$http.get('http://localhost:8080/RestfulAndAngularJS_Server/rest/product/findall').success(function(response){
  $window.alert('success')
}).error(function(data, status, headers, config) {
  $window.alert('failure')
});

i want solution for this immediately please mail me if any one have the answer or sample code.

解决方案

Take a look at the docs about angular's $resource.

这篇关于Angularjs以REST风格Web服务连接如的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆