嗨,在我的要求中,我尝试使用ngresource编写post方法,但现在我想将其更改为get方法。任何人都可以帮助我解决这个问题。我是新来angularjs预先感谢如何使用ng资源编写get方法
$scope.clickresult = {};
var Call = $resource('../api/Home', {}, { query: { method: 'POST', isArray: true} });
$scope.click = function() {
//alert("hi");
$scope.selected = "";
var x = $('#txtSearch').val();
var _ReqObj = new Object();
_ReqObj.id = x;
_ReqObj.Meth = "CD";
// alert(x);
Call.query({}, _ReqObj,
function (response) {
if (response == '') {
// alert('no data');
window.location.replace("#/");
}
else {
//alert("daata");
$scope.message = response;
}
},
function (error) {
window.location.replace("#/");
}
);
};
你连续三次问这个问题。请关闭其中两个问题,只留下一个问题。 –
因为那个问题很重要 – chaitanya
我明白你想要一个答案。请在尝试阅读文档之前先仔细阅读以下内容:https://docs.angularjs.org/api/ngResource/service/$resource –