<commit_before>angular.module('DetailCtrl', [])
.controller('DetailController', ['$scope', '$stateParams', function($scope, $stateParams) {
    
    var resolveElement = function(id) {
        for (var i = 0; i < $scope.elements.length; i++) {
            var element = $scope.elements[i];
            if (element._id == id)
                return element;
        }
        return {};
    };

    $scope.element = resolveElement($stateParams.id);

}]);<commit_msg>update from detail<commit_after>angular.module('DetailCtrl', [])
.controller('DetailController', ['$scope', '$stateParams', 'ElementsService', function($scope, $stateParams, ElementsService) {
    
    var resolveElement = function(id) {
        for (var i = 0; i < $scope.elements.length; i++) {
            var element = $scope.elements[i];
            if (element._id == id)
                return element;
        }
        return {};
    };

    $scope.update = function(element) {
        ElementsService.save(element)
        .success(function(element) {
            $scope.element = element;
        })
        .error(function(error, status) {
            console.log(error);
        });
    };

    $scope.element = resolveElement($stateParams.id);

}]);
{'fraction_non_alphanumeric': 0.15716612377850162, 'fraction_numerical': 0.0016286644951140066, 'mean_word_length': 2.3856749311294765, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2252788', 'n_tokens_mistral': 350, 'n_tokens_neox': 340, 'n_words': 67}