OSDN Git Service

Create SelectCommand with Modal window
[eos/zephyr.git] / front-end / app / scripts / controllers / Execution.ts
1 namespace app.controllers {
2     export class Execution {
3
4         public static $inject = ['MyModal', '$scope'];
5
6         public commandInfoList: declares.CommandInfo[];
7
8         public page: string;
9
10         constructor(private MyModal: services.MyModal, private $scope: ng.IScope) {
11             this.commandInfoList = [];
12         };
13
14         public add() {
15             // close all <uib-accordion> tag
16             this.$scope.$broadcast('close');
17             
18             // add <command> directive
19             this.MyModal.selectCommand();
20             this.commandInfoList.push(new declares.CommandInfo('mrcImageNoiseAdd'));
21         }
22
23         public open() {
24             var result = this.MyModal.open('SelectCommand');
25             console.log(result);
26         }
27
28         public remove(index: number, list: declares.CommandInfo[]) {
29             list.splice(index, 1);
30
31             /**
32              * Commandディレクティブから実行する際にはExecution.commandInfoListの参照を取得できない。
33              * ディレクティブ経由でExecution.commandInfoListの参照を取得。
34              * this.commandInfoList.splice(index, 1);
35              * 上記のコードは実行できない。
36              * thisがremoveの呼び出し元となるため。
37              */
38         }
39
40         public close() {
41             console.log("close");
42         }
43     }
44 }