angular.module("myApp").controller('groupProjectShowController', function ($scope,$stateParams,$http,$filter) {
    $scope.listGruopProject = [];
    $scope.currentPage = 1;
    $scope.numPerPage = 3;
    $scope.maxSize = 5;
    $scope.numberOfPage = numberOfPage;
    $scope.dataHasLoaded = false;
    $scope.getAll = getAll;
    $scope.getTotalItems = getTotalItems;

    getAll();

    function getTotalItems() {
        return $filter('filter')($scope.listGruopProject).length;
    }

    $scope.pageChangedIndex = function(){
        console.log($scope.currentPage);
    }

    function numberOfPage() {
        return Math.ceil($scope.listGruopProject.length / $scope.numPerPage);

    };
    function getAll() {
        $http.get('http://localhost:8081/thong-tin-du-an/' + $stateParams.ID).then(successCallback, errorCallback);

        function successCallback(response) {
            console.log(response.data);
            {
                $scope.listGruopProject = response.data;
            }
        }

        function errorCallback(error) {
            //error code
            console.log("can't get data!!");
        }
    }
});