1 namespace app.directives {
3 export class Directory implements ng.IDirective {
5 public restrict: string;
6 public replace: boolean;
7 public templateUrl: string;
8 private fileInfo: declares.IFileInfo;
9 public controller: string;
10 public controllerAs: string;
11 public bindToController: Object;
21 this.controller = 'directoryController';
22 this.controllerAs = 'ctrl';
23 this.bindToController = {
29 this.templateUrl = 'templates/directory.html';
34 * @returns {function(): HeaderMenu}
37 public static Factory(): ng.IDirectiveFactory {
38 var directive = () => {
39 return new Directory();
45 export class DirectoryController {
47 public static $inject = ['APIEndPoint', '$scope'];
49 // From parent directive bindToController property
50 public info: declares.IDirectoryInfo;
51 public files:declares.IFileInfo[];
53 public list: declares.IDirectoryInfo[];
55 constructor(private APIEndPoint: services.APIEndPoint, private $scope: ng.IScope) {
56 var controller = this;
59 .getFiles(this.info.fileId)
62 if(result.status === 'success') {
63 controller.files = result.info;
64 angular.forEach(result.info, (file) => {
65 if(file.fileType === '0') {
67 if(controller.info.path === '/') {
68 o.path = '/' + file.name;
70 o.path = controller.info.path + '/' + file.name;
73 controller.add()(o, controller.list);