import template from "./Modal.html"; import style from "antd/lib/modal/style/index.css"; angular.module("esNgAntd").directive("antdModal", function (esNgAntd) { return { controllerAs: "antdModal", restrict: "E", transclude: true, replace: true, scope: { visible: "@", title: "@", okText: "@", cancelText: "@", onOk: "&", onCancel: "&", width: "@", footer: "@", }, template: template, controller: function ($scope, $element, $attrs) { 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); }, }; });