Base solution for your next web application
Open Closed

dynamic api controllers as angularjs services #887


User avatar
0
anelengqandu created

Hi

Have problem with angular service, does not hit my my method on Application side

(function() {
    angular.module('app').controller('app.views.employees.index', [
        '$scope', '$modal', 'abp.services.app.employees',
        function ($scope, $modal, employeeService) {
            var vm = this;

            vm.employees = [];

            function getEmployees() {
                employeeService.getEmployees({}).success(function (result) {
                    vm.employees = result.items;
                });
            }

            vm.openEmployeeCreationModal = function() {
                var modalInstance = $modal.open({
                    templateUrl: '/App/Main/views/employees/createModal.cshtml',
                    controller: 'app.views.employees.createModal as vm',
                    backdrop: 'static'
                });

                modalInstance.result.then(function () {
                    getEmployees();
                });
            };

            getEmployees();
        }
    ]);
})();
public ListResultOutput<EmployeeDto> GetEmployees() {
            var employees = _employeeRepository.GetAll();
            return new ListResultOutput<EmployeeDto> { Items=Mapper.Map<List<EmployeeDto>>(employees)};
        }

What am I missing maybe?


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

    What's your application service class and interface names?

  • User Avatar
    0
    anelengqandu created

    Hi, i managed to get the problem, another file that was hidden had the same controller name :roll: