Merge "[1707-OS] Updated license text according to the"
[sdc.git] / catalog-ui / src / app / directives / tag / tag-directive.ts
1 'use strict';
2
3 export class TagData {
4     tag:string;
5     tooltip:string;
6     id:string;
7 }
8
9 export interface ITagScope extends ng.IScope {
10     tagData:TagData;
11     onDelete:Function;
12     delete:Function;
13     hideTooltip:boolean;
14     hideDelete:boolean;
15     sdcDisable:boolean;
16 }
17
18 export class TagDirective implements ng.IDirective {
19
20     constructor() {
21     }
22
23     scope = {
24         tagData: '=',
25         onDelete: '&',
26         hideTooltip: '=',
27         hideDelete: '=',
28         sdcDisable: '='
29     };
30
31     replace = true;
32     restrict = 'EA';
33     template = ():string => {
34         return require('./tag-directive.html');
35     };
36
37     link = (scope:ITagScope) => {
38         scope.delete = ()=> {
39             scope.onDelete({'uniqueId': scope.tagData.id});
40         }
41     };
42
43     public static factory = ()=> {
44         return new TagDirective();
45     };
46
47 }
48
49 TagDirective.factory.$inject = [];