Created
January 24, 2016 20:02
-
-
Save iyhammad/da1ed67653cadd0afe21 to your computer and use it in GitHub Desktop.
Sample Angular TypeScript Controller that use ABP generated defenitions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module app.views.employee.basicInformation { | |
export class add { | |
private employee: any; | |
private addEntry: () => void; | |
private isValidBusinessData: boolean; | |
private directorates: Array<any> | |
private departments: Array<any>; | |
private units: Array<any>; | |
private locations: Array<any>; | |
private nationalities: Array<any>; | |
private genders: Array<any> = [{ id: 1, name: 'Not Specified' }, { id: 2, name: 'Male' }, { id: 3, name: 'Female' }]; | |
private maritalStatuses: Array<any> = [{ id: 1, name: 'Not Specified' }, { id: 2, name: 'Single' }, { id: 3, name: 'Married' }, { id: 4, name: 'Divorced' }]; | |
public static $inject = [ | |
'$stateParams', | |
'abp.services.hrpayroll.employee', | |
'$state', | |
'abp.services.hrpayroll.organization', | |
'abp.services.hrpayroll.people', | |
'$scope' | |
, 'hrPayroll.spinner' | |
]; | |
constructor($stateParams: angular.ui.IStateParamsService, employeeService: abp.services.hrpayroll.employee, $state: angular.ui.IStateService | |
, organizationService: abp.services.hrpayroll.organization, peopleService: abp.services.hrpayroll.people, private $scope: angular.IScope, private spinnerService: hrPayroll.spinner) | |
{ | |
var self = this; | |
self.employee = {}; | |
self.employee.employeeId = $stateParams['id']; | |
spinnerService.setBusy(null, organizationService.getActiveLocations({ currentPage: 1, pageSize: 100, searchTerm: "" }).success(function (data) { | |
self.locations = data.locationsList; | |
})); | |
spinnerService.setBusy(null, organizationService.getActiveUnits({ currentPage: 1, pageSize: 100, searchTerm: "" }).success(function (data) { | |
self.units = data.unitsList; | |
})); | |
spinnerService.setBusy(null, organizationService.getActiveDepartments({ orderBy:"Name",currentPage: 1, pageSize: 100, searchTerm: "" }).success(function (data) { | |
self.departments = data.departmentsList; | |
})); | |
spinnerService.setBusy(null, organizationService.getActiveDirectorates({ orderBy: "Name",currentPage: 1, pageSize: 100, searchTerm: "" }).success(function (data) { | |
self.directorates = data.directoratesList; | |
})); | |
spinnerService.setBusy(null, peopleService.getActiveNationalities({ currentPage: 1, pageSize: 100, searchTerm: "" }).success(function (data) { | |
self.nationalities = data.nationalitiesList; | |
})); | |
self.addEntry = function () { | |
spinnerService.setBusy(null, employeeService.addEmployee({ employee: self.employee }).success(function (data) { | |
abp.message.success('Employee added successfully', 'Employee'); | |
$state.go('employee.basicInformation', { id:data.employeeId}); | |
})); | |
} | |
} | |
} | |
} | |
var myapp = angular.module("app"); | |
myapp.controller('app.views.employee.basicInformation.add', app.views.employee.basicInformation.add); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got this working as well here is another sample using lambda. This stuff is amazing magic is my eyes. Thank you so much for doing this!!!!!
class CustomerSearch {
static $inject = ['$scope','abp.services.app.customer', '$state'];
customerInput: GetCustomerInput;
loading: boolean;
source: kendo.data.DataSource;
constructor(private $scope: ng.IScope, private customerService: abp.services.app.customer, private $state: ng.ui.IStateService) {
var vm = this;
vm.customerInput = new GetCustomerInput();
}
}