带有restfull Web服务的angularjs

带有restfull Web服务的angularjs,angularjs,Angularjs,我的angularjs应用程序位于/home/scriplogix/higi/kiosk文件夹中,我在eclipse中创建了一个restfull Web服务,它生成了一个链接 现在我想将我的本地应用程序连接到restfullwebservice。我有两个疑问 是否可以连接到本地应用程序以恢复完整的Web服务 我正在使用代码 return $http.get('http://localhost:8080/RestfulAndAngularJS_Server/rest/product/findall

我的angularjs应用程序位于/home/scriplogix/higi/kiosk文件夹中,我在eclipse中创建了一个restfull Web服务,它生成了一个链接

现在我想将我的本地应用程序连接到restfullwebservice。我有两个疑问

  • 是否可以连接到本地应用程序以恢复完整的Web服务
  • 我正在使用代码

    return $http.get('http://localhost:8080/RestfulAndAngularJS_Server/rest/product/findall')
    .success(function(data, status, headers, config){
        $window.alert('success')
        $window.alert('data'+data)
    })
    .error(function(data, status, headers, config) {
        $window.alert('failure');
    }); //it will work out or not
    
  • 是的
  • 你说得对

  • 但是,您可能需要在restfull网站的答案中添加标题“Access Control Allow Origin”。如果您的angular应用程序与restfull服务位于同一服务器上,则更好。

    但该代码不起作用,状态为0,我需要在其中放置访问控制允许或我需要在其中放置访问控制允许-Origi@panduk使用Fiddler捕获流量并进行检查。可能是你的服务不起作用。Access Control Allow Origin是服务器端(web服务端)的自定义标头。的可能重复项