Blame view

build/SelectOption/SelectOption.js 970 Bytes
dd962f77   Imshann   优化
1
2
3
4
  /**
   * 选项
   */
  import template from "./SelectOption.html";
81f8a467   Imshann   调整组件前缀
5
  angular.module("esNgAntd").directive("antdSelectOption", function () {
dd962f77   Imshann   优化
6
      return {
81f8a467   Imshann   调整组件前缀
7
          controllerAs: "antdSelectOption",
dd962f77   Imshann   优化
8
9
10
11
12
13
14
          restrict: "E",
          transclude: true,
          replace: true,
          scope: {
              value: "@",
          },
          template: template,
81f8a467   Imshann   调整组件前缀
15
          controller: function ($scope, $element, $attrs) {
dd962f77   Imshann   优化
16
17
18
19
20
21
22
23
              this.getContext = function () {
                  return $scope;
              };
  
              $scope.state = {
                  label: null,
              };
          },
81f8a467   Imshann   调整组件前缀
24
          require: ["?^antdSelect"],
dd962f77   Imshann   优化
25
          link: function ($scope, $element, $attrs, $controllers, $transclude) {
81f8a467   Imshann   调整组件前缀
26
27
28
              let [antdSelect] = $controllers;
              $scope.antdSelect = antdSelect.getContext();
              $scope.antdSelect.addOption({
dd962f77   Imshann   优化
29
30
31
32
33
34
35
                  value: $scope.value,
                  label: null,
                  element: $element,
              });
          },
      };
  });