Icon.js
907 Bytes
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>`
);
},
};
});