aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives/inputs-and-properties/properties/property-row-directive.ts
blob: a9ff71cda58813df49631f051436db95fe0d82e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
 * Created by obarda on 1/8/2017.
 */
'use strict';

export interface IPropertyRowDirective extends ng.IScope {
    onNameClicked:Function;
    isClickable:boolean;
}

export class PropertyRowDirective implements ng.IDirective {

    constructor() {

    }

    scope = {
        property: '=',
        instanceName: '=',
        instanceId: '=',
        instancePropertiesMap: '=',
        onNameClicked: '&',
        onCheckboxClicked: '&'
    };

    restrict = 'E';
    replace = true;
    template = ():string => {
        return require('./property-row-view.html');
    };

    link = (scope:IPropertyRowDirective, element:any, $attr:any) => {
        scope.isClickable = $attr.onNameClicked ? true : false;
    };

    public static factory = ()=> {
        return new PropertyRowDirective();
    };

}

PropertyRowDirective.factory.$inject = [];