{"size": 682, "ext": "js", "max_stars_repo_path": "src/modals/modal.js", "max_stars_repo_name": "JethroPham/CRUD-Node-Postgresql-Angularjs", "max_stars_repo_stars_event_min_datetime": "2018-12-17T18:14:30.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-17T18:14:35.000Z", "max_issues_repo_path": "src/modals/modal.js", "max_issues_repo_name": "JethroPham/CRUD-Node-Postgresql-Angularjs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/modals/modal.js", "max_forks_repo_name": "JethroPham/CRUD-Node-Postgresql-Angularjs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.28, "max_line_length": 126, "alphanum_fraction": 0.582111437}
angular.module('postgreDbApp.ModalController', [])
.controller("ModalController",["$scope", "getAllChickens", "$uibModalInstance", "$chicken", function($scope, $getAllChickens, 
    $uibModalInstance, $chicken) {

    $scope.vm = {};
    $scope.vm.modal = {};
    
    if($chicken) {
        $getAllChickens.getSingleChicken($chicken)
        .then(function(data) {
            $scope.vm.modal = data.data.data;
        })
    }

    $scope.vm.ok = function(data) {
        $getAllChickens.createChicken(data)
        .then(function(data) {
            $uibModalInstance.close(data);
        })
    }

    $scope.vm.cancel = function() {
        $uibModalInstance.close();
    }
}])