1 app.controller('samplePageController', function($scope, $http,ProfileService,modalService){
4 $scope.scrollViewPerPage=2;
8 $scope.searchString="";
9 $scope.currentPageNum=1;
10 ProfileService.getProfilePagination(1,$scope.viewPerPage).then(function(data){
12 $scope.data = JSON.parse(j.data);
13 $scope.tableData =JSON.parse($scope.data.profileList);
14 $scope.totalPages =JSON.parse($scope.data.totalPage);
15 for(x in $scope.tableData){
16 if($scope.tableData[x].active_yn=='Y')
17 $scope.tableData[x].active_yn=true;
19 $scope.tableData[x].active_yn=false;
23 console.log("failed");
27 $scope.$watch('currentPageNum', function(val) {
29 ProfileService.getProfilePagination(val,$scope.viewPerPage).then(function(data){
31 $scope.data = JSON.parse(j.data);
32 $scope.tableData =JSON.parse($scope.data.profileList);
33 $scope.totalPages =JSON.parse($scope.data.totalPage);
34 for(x in $scope.tableData){
35 if($scope.tableData[x].active_yn=='Y')
36 $scope.tableData[x].active_yn=true;
38 $scope.tableData[x].active_yn=false;
42 console.log("failed");
47 $scope.editRow = function(profileId){
48 window.location = 'userProfile#/profile/' + profileId;
51 $scope.toggleProfileActive = function(rowData) {
52 modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?",
54 $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){});
57 rowData.active=!rowData.active;