Blame view

build/Modal/Modal.js 1.25 KB
3a3ecabe   Imshann   init
1
2
  import template from "./Modal.html";
  import style from "antd/lib/modal/style/index.css";
81f8a467   Imshann   调整组件前缀
3
  angular.module("esNgAntd").directive("antdModal", function (esNgAntd) {
3a3ecabe   Imshann   init
4
      return {
81f8a467   Imshann   调整组件前缀
5
          controllerAs: "antdModal",
3a3ecabe   Imshann   init
6
7
8
9
10
11
12
13
14
15
16
17
18
19
          restrict: "E",
          transclude: true,
          replace: true,
          scope: {
              visible: "@",
              title: "@",
              okText: "@",
              cancelText: "@",
              onOk: "&",
              onCancel: "&",
              width: "@",
              footer: "@",
          },
          template: template,
81f8a467   Imshann   调整组件前缀
20
          controller: function ($scope, $element, $attrs) {
3a3ecabe   Imshann   init
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
              this.getContext = function () {
                  return $scope;
              };
  
              $scope.state = {
                  width: $scope.width || 416,
                  okText: $scope.okText || "确定",
                  cancelText: $scope.cancelText || "取消",
              };
  
              $scope.handleClose = function () {
                  if (typeof $scope.onCancel === "function") {
                      $scope.onCancel();
                  }
              };
          },
          link: function ($scope, $element, $attrs, $controllers, $transclude) {
              $element[0].removeAttribute("title");
              esNgAntd.createStyle("ant-modal", style);
          },
      };
  });