Blame view

build/CheckableTag/CheckableTag.js 897 Bytes
3a3ecabe   Imshann   init
1
2
  import template from "./CheckableTag.html";
  import style from "antd/lib/tag/style/index.css";
81f8a467   Imshann   调整组件前缀
3
  angular.module("esNgAntd").directive("antdCheckableTag", function (esNgAntd) {
3a3ecabe   Imshann   init
4
      return {
81f8a467   Imshann   调整组件前缀
5
          controllerAs: "antdCheckableTag",
3a3ecabe   Imshann   init
6
7
8
9
10
11
12
13
          restrict: "E",
          transclude: true,
          replace: true,
          scope: {
              checked: "@",
              onChange: "&",
          },
          template: template,
81f8a467   Imshann   调整组件前缀
14
          controller: function ($scope, $element, $attrs) {
3a3ecabe   Imshann   init
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
              this.getContext = function () {
                  return $scope;
              };
  
              $scope.handleClick = function () {
                  $scope.onChange({
                      checked: !($scope.checked === "true"),
                  });
              };
          },
          link: function ($scope, $element, $attrs, $controllers, $transclude) {
              esNgAntd.createStyle("ant-tag", style);
          },
      };
  });