CheckableTag.js 897 Bytes
import template from "./CheckableTag.html";
import style from "antd/lib/tag/style/index.css";
angular.module("esNgAntd").directive("antdCheckableTag", function (esNgAntd) {
    return {
        controllerAs: "antdCheckableTag",
        restrict: "E",
        transclude: true,
        replace: true,
        scope: {
            checked: "@",
            onChange: "&",
        },
        template: template,
        controller: function ($scope, $element, $attrs) {
            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);
        },
    };
});