3a3ecabe
Imshann
init
|
1
2
|
import * as iconsSvg from "@ant-design/icons-svg";
import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
|
dd962f77
Imshann
优化
|
3
|
angular.module("esNgAntd").directive("esIcon", function ($compile) {
|
3a3ecabe
Imshann
init
|
4
5
6
7
8
9
10
11
|
return {
controllerAs: "esIcon",
restrict: "E",
transclude: true,
replace: true,
scope: {
type: "@",
},
|
dd962f77
Imshann
优化
|
12
|
template: `<span class="anticon"></span>`,
|
3a3ecabe
Imshann
init
|
13
|
link: function ($scope, $element, $attrs, $controllers, $transclude) {
|
dd962f77
Imshann
优化
|
14
15
16
17
18
19
20
21
22
|
let template = renderIconDefinitionToSVGElement(
iconsSvg[$scope.type],
{
extraSVGAttrs: {
width: "1em",
height: "1em",
fill: "currentColor",
},
}
|
3a3ecabe
Imshann
init
|
23
|
);
|
dd962f77
Imshann
优化
|
24
|
$element.append(template);
|
3a3ecabe
Imshann
init
|
25
26
27
|
},
};
});
|