Я хочу создать новый файл внутри файла. Как мне этого добиться?
Ниже я получаю файлы и их пути, и я могу получить к ним доступ
<div ng-repeat="t in main.path" style="padding:10px; float:left">
<button type="button" class="btn btn-default" ng-click="getFiles(t.path)">
<span class="glyphicon glyphicon-folder-close" style="padding-right:10px"></span>{{t.name}}
</button>
</div>
<div ng-repeat=" t in files" style="clear:both">
<button type="button" class="btn btn-default" ng-if="t.children==true" ng-click="getFiles('projects/'+t.path)" style="margin:10px">
<span class="glyphicon glyphicon-folder-close" style="padding-right:10px"></span>{{t.name}}</button>
<a href="http://xyz.ngrok.io/{{t.path}}" download class="btn btn-default" role="button" ng-if="t.children==false" style="margin:10px">
<i class="fas fa-folder">download</i> {{t.name}}</button>
</div>
Я хочу создать новую папку по пути, по которому я щелкнул. Как я могу это сделать?
<form ng-submit="createFolder('projects/'+files.path)">
<div class="modal fade" id="createFolderModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Create Folder</h4>
</div>
<div class="modal-body">
<input type="text" name="directory" ng-model="createfolder">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default">Create</button>
</div>
</div>
</div>
</div>
</form>
Ниже мой контроллер
angular.module('filesController', [])
.controller('filesCtrl', function (User, $scope, $http) {
$scope.getFiles = function (path) {
var Obj = {
path: path,
}
console.log(Obj);
$http.post('http://xyz/api/file/path', Obj).then(function (result) {
console.log(result);
$scope.files = result.data.project;
});
}
$scope.createFolder = function (path) {
var create = {
createfolder: $scope.createfolder,
path: path,
}
console.log(create);
/*$http.post('http://xyz/api/createfolder', create).then(function (result) {
console.log(result);
$scope.files = result.data.project;
});*/
}