ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 255.1k

How to convert this code from angular js to typescript angu7

May 6 2020 7:45 PM
How to convert this code from angular js to typescript anguar 7 ?
 
I work on project do pagination for data returned 
 
but i have this code as angular js
 
currently i work on angular 7 project and i need to do pagination
 
so I need to convert this code from angular js to angular 7 
 
so How to do that please ? 
 
  1. var app = angular.module('employeeApp', ['ui.bootstrap']);    
  2. app.controller('employeeCtrl'function ($scope, $http) {    
  3.     $scope.maxSize = 5;     // Limit number for pagination display number.    
  4.     $scope.totalCount = 0;  // Total number of items in all pages. initialize as a zero    
  5.     $scope.pageIndex = 1;   // Current page number. First page is 1.-->    
  6.     $scope.pageSizeSelected = 5; // Maximum number of items per page.    
  7.     $scope.getEmployeeList = function () {    
  8.         $http.get("http://localhost:52859/api/Employee?pageIndex=" + $scope.pageIndex + "&pageSize=" + $scope.pageSizeSelected).then(    
  9.                        function (response) {    
  10.                            $scope.employees = response.data.employees;    
  11.                            $scope.totalCount = response.data.totalCount;    
  12.                        },    
  13.                        function (err) {    
  14.                            var error = err;    
  15.                        });    
  16.     }    
  17.     //Loading employees list on first time    
  18.     $scope.getEmployeeList();    
  19.     //This method is calling from pagination number    
  20.     $scope.pageChanged = function () {    
  21.         $scope.getEmployeeList();    
  22.     };    
  23.     //This method is calling from dropDown    
  24.     $scope.changePageSize = function () {    
  25.         $scope.pageIndex = 1;    
  26.         $scope.getEmployeeList();    
  27.     };    
  28. });  
 

Answers (1)