RadioButton.js 946 Bytes
import template from "./RadioButton.html";
angular.module("esNgAntd").directive("antdRadioButton", function () {
    return {
        controllerAs: "antdRadioButton",
        restrict: "E",
        transclude: true,
        replace: true,
        scope: {
            value: "@",
        },
        controller: function ($scope, $element, $attrs) {
            this.getContext = function () {
                return $scope;
            };

            $scope.state = {
                checked: false,
            };

            $scope.handleClick = function (event) {
                $scope.antdRadioGroup.setValue(event);
            };
        },
        require: ["?^antdRadioGroup"],
        link: function ($scope, $element, $attrs, $controllers, $transclude) {
            let [antdRadioGroup] = $controllers;
            $scope.antdRadioGroup = antdRadioGroup.getContext();
            $element.removeAttr("value");
        },
    };
});