자바에서 편안한 서비스를 작성하고 angularjs에서 호출했지만 작동하지 않습니다. 정적 json 형식으로 작업하면됩니다. 그러나 RESTful 서비스에서는 작동하지 않습니다. 아래 코드는 서비스 코드입니다. angularjs에서 편안한 서비스를 호출하는 방법
angular.module('intelesant.services', [])
.value('version', '0.1')
.service('customers1',function(){
return $resource('http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo', {}, {
query: { method: 'GET', isArray: true },
create: { method: 'POST' }
})
});
내 컨트롤러 파일은 쉽게 응용 프로그램에서 편안하고 서비스를 구현할 수 Restangular라는 AngularJS와 서비스가 있습니다
intelesant.controller('HomeController', ['$scope','customers1', function(s,customers) {
alert(JSON.stringify(customers));
s.homeContent = 'Test Content for Home page. This can come from server via REST service.';
}]);
미안 해요 stackoverflow 코드는 내 붙여 넣기가 좋지 않았지만 바이올린을 봅니다. 데모 계정을 사용하여 많은 액세스로 인해 실행할 때 오류가 발생하지만 제대로 작동하는 것 같습니다. –