angularful与restfull webservice

时间:2015-07-22 12:05:42

标签: angularjs

是否可以使用位于c:// Higi文件夹中的angularjs.my应用程序来传达restfull webservice,我现在在eclipse中创建了restfull webservice我正在使用return

$http.get('http://localhost:8080/RestfulAndAngularJS_Server/rest/product/findall')
 .success(function(response){
                $window.alert('success')
}); 

用于连接restfull webservice的代码是否可行

1 个答案:

答案 0 :(得分:0)

如果您的http://localhost:8080/RestfulAndAngularJS_Server/rest/product/findall端点一般可以访问,那么应该可以通过角度$ http服务访问它。

您可以通过在浏览器中粘贴该网址来测试服务器是否已启动。根据您在内容协商方面设置服务器端代码的方式,您可能会收到错误(哪个错误取决于您用于构建Web服务的内容,但至少您已经知道它' ; s up)。

如果它已经启动,那么您应该能够从角度$ http服务中调用它。如果没有,那么请确保它的'通过启动你在eclipse中使用的任何服务器来运行。

如果您确定服务器已启动并正在运行,则您的呼叫应该可以正常运行。你也可以考虑在你的$ http.get调用中处理错误回调,看看什么是'发生在那里。

相关问题