OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-10-14 3052936fed9166521b0557a36df83eb11a5e51ee
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
 * Created by wisestone on 2018-09-05.
 */
'use strict';
 
define(['app', 'angular'],
    function (app, angular) {
        app.directive('issueSearchArrayViewElement', ["$log", "$compile",
            function ($log, $compile) {
                return {
                    restrict: 'AE',
                    scope: {
                        lists : "=",
                        type : "="
                    },
                    link: function ($scope, $element, $attrs) {
 
                        $scope.fn = {
                            makeSearchElements : makeSearchElements, //  선택한 검색 대상 값을 화면에 표시한다.
                            remove : remove //  선택한 대상 값을 초기화한다.
                        };
 
                        $scope.$watch("lists", function () {
                            $element.empty();
                            $scope.fn.makeSearchElements();
                        }, true);
 
 
                        function remove(id) {
                            var tempLists = [];
 
                            angular.forEach($scope.lists, function (target) {
                                if (target.id != id) {
                                    tempLists.push(target);
                                }
                            });
 
                            $scope.lists = angular.copy(tempLists);
                        }
 
 
                        function makeSearchElements() {
                            var makeTag = "";
 
                            angular.forEach($scope.lists, function (list) {
                                makeTag += "<p>";
                                switch($scope.type) {
                                    case "user":
                                        makeTag += list.byName;
                                        break;
 
                                    case "project":
                                        makeTag += list.name;
                                        break;
                                }
 
 
                                makeTag += "<span ng-click='fn.remove(" + list.id + ")'>×</span>";
                                makeTag += "</p>";
                            });
 
                            var linkFn = $compile(makeTag);
                            var content = linkFn($scope);
                            $element.append(content);
                        }
 
                    }
                };
            }])
    });