{"size": 968, "ext": "js", "max_stars_repo_path": "sierra-web/src/main/webapp/src/modules/especies/delete/especieDelete.ctrl.js", "max_stars_repo_name": "Uniandes-isis2603/s1_201820_sierra", "max_stars_repo_stars_event_min_datetime": "2019-09-23T19:18:48.000Z", "max_stars_repo_stars_event_max_datetime": "2019-09-23T19:18:48.000Z", "max_issues_repo_path": "sierra-web/src/main/webapp/src/modules/especies/delete/especieDelete.ctrl.js", "max_issues_repo_name": "Uniandes-isis2603/s1_201820_sierra", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sierra-web/src/main/webapp/src/modules/especies/delete/especieDelete.ctrl.js", "max_forks_repo_name": "Uniandes-isis2603/s1_201820_sierra", "max_forks_repo_forks_event_min_datetime": "2021-07-20T20:09:02.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-20T20:09:02.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 37.2307692308, "max_line_length": 124, "alphanum_fraction": 0.5134297521}
(function (ng) {
    var mod = ng.module("especieModule");
    mod.constant("especiesContext", "api/especies");
    mod.controller('especieDeleteCtrl', ['$scope', '$http', 'especiesContext', '$state',

        function ($scope, $http, especiesContext, $state) {
           
           
            var idEspecie = $state.params.especieId;
            
                 $http.get(especiesContext).then(function (response) { 
                 $scope.especieRecords = response.data;
                 $scope.currentEspecie = $filter('filter')($scope.especieRecords, {id: $state.params.especieId}, true)[0];  
                });
                
             
            $scope.deleteEspecie = function () {
                $http.delete(especiesContext + '/' + idEspecie, {}).then(function (response) {
                    $state.go('especiesList', {idEspecie: response.data.id}, {reload: true});
                });
            };
        }
    ]);
}
)(window.angular);
