function endecodeCtrl($scope,Endecode) {
    $scope.file_list = [];
    $scope.endecodes = [];
    $scope.$on("getFileList",function(eve,data){
        $scope.file_list.length = 0;
        $scope.file_list = data; 
    }); 
    var new_endecode = function(){
        this.key = "";
        this.file_name = "";
        this.command = "";
        this.desc = "";
    }
    $scope.new_endecode = new new_endecode();
    $scope.saveEnDecode = function(){
        Endecode.save($scope.new_endecode,function(res){
            $scope.endecodes.push(res);
            $scope.new_endecode = new new_endecode();
        })
    }
    $scope.getEndecode = function(){
        Endecode.query({},function(res){
            $scope.endecodes.length = 0;
            $scope.endecodes = res
        })
    }
    $scope.getEndecode();
    $scope.deleteEndecode = function(endecode){
        Endecode.delete({_id:endecode._id},function(res){
            _.remove($scope.endecodes,{_id:endecode._id})
        })
    }
}   
endecodeCtrl.$inject = ["$scope","Endecode"];
BP.controller("endecodeCtrl", endecodeCtrl);
