Base solution for your next web application
Open Closed

Send a GET request using Services in AngularJs #292


User avatar
0
mrp created

I want to send a GET request instead of POST request in the following code :

(function () {
    var controllerId = 'app.views.home';
    angular.module('app').controller(controllerId, [
        '$scope', 'abp.services.qoranic.aya', function ($scope, ayaService) {
            var vm = this;

            vm.ayas = [];

            ayaService.getAyaTranslate({ type: "simple", transType: "fa.ghomshei", pageNum: 1, startAya: 0, endAya: 7 }).success(function (data) {
                debugger;
                vm.ayas = data;
            });
        }
    ]);
})();

But it send a POST request to my C# Service but I want it send a GET request to fulfill this signature :

Task<AyaTranslateOutPut> GetAyaTranslate(string type, string transType, int pageNum, int startAya, int endAya, string version = null);

I know this code will work but I want to send using services and not direct Ajax call like this :

abp.ajax({
                url: '/api/services/qoranic/aya/GetAyaTranslate',
                data: { type: "simple", transType: "fa.ghomshei", pageNum: 1, startAya: 0, endAya: 7 },
                method: "GET"
            }).done(function (data) {
                vm.ayas = data;
            });

Thank you in forward for your answers.


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Dynamic web api layer works with POST only. Other verbs will be implemented soon. Folow the project. Thanks.