如何通过休息服务中的ng-click事件提取angularjs $ http.get请求中发送的参数。
控制器:
angular.module('myApp', []).controller("myCtrl", function ($scope, $http) {
$scope.checkName = function(input) {
$http({
method:'GET',
url:'http://localhost:8080/AngularWEB/rest/hello/name',
params: {name: input}
}).success(function (data) {
$scope.getName = data;
});
}
});
休息服务:
@GET
@Produces("text/plain")
@Path("/name")
public Response getName(String name) {
String output = "The Name is : " + name;
return Response.status(200).entity(output).build();
}
名称为空