text: app.controller('roleController',($scope,$http,logify)=>{
      $scope.messageClass = 'alert alert-danger alert-dismissible';
      $scope.iconClass = 'mdi mdi-close-circle-o';
      $scope.pages =[];
      $scope.count = 8;
      $scope.errors=[];
      $scope.cPage=location.hash?location.hash.substring(1):1;
      $scope.loadRoles =(page=1)=>{
          $http.get('/api/s/role/all/'+page)
              .then((response)=>{
                      if(response.data.status){
                          $scope.roles = response.data.roles;
                          //console.log($scope.roles);
                      }
                      else{
                          $scope.errorMessage = `### ${response.data.message} ### Server error. -roles- not loading..`;
                      }
                  },(rejection)=>{
                      $scope.errorMessage = `### ${rejection.statusText} ### Angular Client error. -roles- not loading..`;
                      logify.createLog($http, {
                          name: "angular-Error",
                          severity: "warning",
                          url: location.pathname,
                          originalUrl: location.pathname,
                          message:$scope.errorMessage
                      });
                  }
              );
      }
      $scope.changePage = (page) => {
          if (page === $scope.cPage)
              return;
          $scope.cPage=page;
          $scope.loadRoles(page);
      }
      $scope.nextPage = ()=>{
          if ($scope.cPage >=$scope.pages.length)
              return;
          $scope.cPage ++;
          location.hash=$scope.cPage;
          $scope.loadRoles($scope.cPage);
      }
      $scope.prevPage = () => {
          if ($scope.cPage<=1)
              return;
          $scope.cPage--;
          location.hash=$scope.cPage;
          $scope.loadRoles($scope.cPage);
      }
      $scope.loadRoles($scope.cPage);
      $http({
          url: '/api/s/role/count/',
          method: 'GET'
      }).then((response) => {
          if (response.data.status) {
              const count = Math.ceil(response.data.count/$scope.count);
              for (let i=1;i<=count;i++){
                  $scope.pages.push(i);
              }
          } else {
              $scope.errorMessage= `## ${response.data.message} ## Server error -count-  not getting ..`;
          }
      }, (rejection) => {
          $scope.errorMessage = `## ${rejection.statusText} ## Angular Client error -count-  not getting  ..`;
          logify.createLog($http, {
              name: "angular-Error",
              severity: "warning",
              url: location.pathname,
              originalUrl: location.pathname,
              message:$scope.errorMessage
          });
      });
      $scope.delete = (id)=>{
          const result = confirm('** do you want to delete ?? **');
          if(result){
              $scope.index = $scope.roles.findIndex(x=>x._id===id);
              const deletedName= $scope.roles[$scope.index].name;
              const result2 = confirm(`*** Warning ?? ***\n.........\n ## ${deletedName} ##-- Role will delete..` );
              if(!result2){
                  return;
              }
              $scope.roles.splice($scope.index,1);
              $http({
                  method:'DELETE',
                  url:'/api/s/role/delete',
                  data:{id:id},
                  headers:{'content-type':'application/json;charset=utf-8'}
              })
                  .then((response)=>{
                      if(!response.data.status){
                          $scope.errorMessage = `--(## ${response.data.message} ## )--Role not deleted,Server error..`;
                      }else {
                          $scope.errorMessage = '*** oh my god , role successfully deleted ... ***'
                          $scope.messageClass = 'alert alert-success alert-dismissible';
                          $scope.iconClass = 'mdi mdi-check';
                      }
                  },(rejection)=>{
                      $scope.errorMessage =`((${rejection.statusText}))--( ##${deletedName}## )-- Role not deleted ...Client error..`;
                      logify.createLog($http, {
                          name: "angular-Error",
                          severity: "warning",
                          url: location.pathname,
                          originalUrl: location.pathname,
                          message:$scope.errorMessage
                      });
                  });
          }
      }
      $scope.reset= ()=>{
          $scope.errorMessage = null;
          $scope.messageClass = 'alert alert-danger alert-dismissible';
          $scope.iconClass = 'mdi mdi-close-circle-o';
      }
  });