Blame view

build/RadioButton/RadioButton.js 946 Bytes
3a3ecabe   Imshann   init
1
  import template from "./RadioButton.html";
81f8a467   Imshann   调整组件前缀
2
  angular.module("esNgAntd").directive("antdRadioButton", function () {
3a3ecabe   Imshann   init
3
      return {
81f8a467   Imshann   调整组件前缀
4
          controllerAs: "antdRadioButton",
3a3ecabe   Imshann   init
5
6
7
8
9
10
          restrict: "E",
          transclude: true,
          replace: true,
          scope: {
              value: "@",
          },
81f8a467   Imshann   调整组件前缀
11
          controller: function ($scope, $element, $attrs) {
3a3ecabe   Imshann   init
12
13
14
15
16
17
18
19
20
              this.getContext = function () {
                  return $scope;
              };
  
              $scope.state = {
                  checked: false,
              };
  
              $scope.handleClick = function (event) {
81f8a467   Imshann   调整组件前缀
21
                  $scope.antdRadioGroup.setValue(event);
3a3ecabe   Imshann   init
22
23
              };
          },
81f8a467   Imshann   调整组件前缀
24
          require: ["?^antdRadioGroup"],
3a3ecabe   Imshann   init
25
          link: function ($scope, $element, $attrs, $controllers, $transclude) {
81f8a467   Imshann   调整组件前缀
26
27
              let [antdRadioGroup] = $controllers;
              $scope.antdRadioGroup = antdRadioGroup.getContext();
3a3ecabe   Imshann   init
28
29
30
31
              $element.removeAttr("value");
          },
      };
  });