Blame view

build/Icon/Icon.js 907 Bytes
3a3ecabe   Imshann   init
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
  import * as iconsSvg from "@ant-design/icons-svg";
  import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
  angular.module("esNgAntd").directive("esIcon", function () {
      return {
          controllerAs: "esIcon",
          restrict: "E",
          transclude: true,
          replace: true,
          scope: {
              type: "@",
          },
          link: function ($scope, $element, $attrs, $controllers, $transclude) {
              $element.replaceWith(
                  `<span class="anticon">${renderIconDefinitionToSVGElement(
                      iconsSvg[$scope.type],
                      {
                          extraSVGAttrs: {
                              width: "1em",
                              height: "1em",
                              fill: "currentColor",
                          },
                      }
                  )}</span>`
              );
          },
      };
  });