1 namespace app.directives {
2 export class Command implements ng.IDirective {
4 public restrict: string;
5 public replace: boolean;
6 public templateUrl: string;
8 public controller: string;
9 public controllerAs: string;
10 public bindToController: Object;
21 this.controller = 'commandController';
22 this.controllerAs = 'ctrl';
23 this.bindToController = {
29 this.templateUrl = 'templates/command.html';
34 * @returns {function(): HeaderMenu}
37 public static Factory(): ng.IDirectiveFactory {
38 var directive = () => {
41 directive.$inject = [];
46 export class CommandController {
48 public static $inject = ['APIEndPoint', '$scope'];
50 // From parent directive.show bindToController property
51 private index: string;
53 private remove: Function;
54 private list: declares.CommandInfo[];
56 // property of ui.bootstrap uib-accordion directive
57 private isOpen: boolean;
58 private heading: string;
60 // property about Option directive
61 private files: string[];
62 private options: declares.IOption[];
64 constructor(private APIEndPoint: services.APIEndPoint, private $scope: ng.IScope) {
65 var controller = this;
67 // Get OptionControlFile and bind it to $scope.options
69 .getOptionControlFile()
71 .then(function(result) {
72 controller.options = result;
75 this.files = ['a.file', 'b.file', 'c.file'];
77 this.heading = "[" + this.index + "]: dcdFilePring";
80 // When call add button at executeController, all accordion close.
81 this.$scope.$on('close', () => {
82 controller.isOpen = false;
88 angular.forEach(this.options, (option) => {
92 angular.forEach(option.arg, (arg) => {
94 inputs.push(arg.input);
98 if(inputs.length > 0) {
99 params[option.option] = inputs;
105 public removeMySelf(index:number) {
106 this.remove()(index,this.list);