私は AngularJS から始めており、REST サービスを使用する必要があります。この GET 呼び出しが機能しないのはなぜですか?
controller.js
angular.module("myApp", []);
function GetController($scope) {
$scope.click = function() {
// $http.defaults.useXDomain = true;
var response = $http.get('http://localhost:8080/ticketsales/pruebas');
response.success(function(data, status, headers, config) {
alert("Ok.");
});
response.error(function(data, status, headers, config) {
alert("Error.");
});
};
}
index.html
<div ng-controller="GetController">
<button ng-click="click()">Click me</button>
</div>