简体   繁体   中英

Aspnetboilerplate how to handle inputs with multiple parameters in angular

I do not know if it's related to abp but I need an advice. Let's say I have "GetMyCustomEntityInput" and it has so many parameters. Since nswag/refresh.bat does not provide me that input class in service-proxies.ts file, should I implement my own GetMyCustomEntityInput in service-proxies.ts file and if so would it work like that and would it be a good approach? I wonder how the abp community handle this case so I wanted to ask.

Thanks in advance.

Please look at this page for how to integrate the automated dynamic service webapi layer with angular services:

https://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API#DocAngularSupport

Example:

(function() {
    angular.module('app').controller('TaskListController', [
        '$scope', 'abp.services.tasksystem.task',
        function($scope, taskService) {
            var vm = this;
            vm.tasks = [];
            taskService.getTasks({
                state: 0
            }).success(function(result) {
                vm.tasks = result.tasks;
            });
        }
    ]);
})();

The parameters for you Dto input are NOT automatically converted to typescript, you have to create a dynamic object for input, so make sure you get the property names correct or it won't work. You could use Typelite/t4 templates to automatically create your Dto's.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM