import template from "./ImagePreviewGroup.html"; angular .module("esNgAntd") .directive("esImagePreviewGroup", function (esNgAntd) { return { controllerAs: "esImagePreviewGroup", restrict: "E", transclude: true, replace: true, template: template, controller: function ($scope, $element) { this.getContext = function () { return $scope; }; $scope.state = { current: 0, visible: false, src: null, childrens: [], }; $scope.addChildren = function (children) { $scope.state.childrens.push(children); return $scope.state.childrens.length - 1; }; $scope.handleOpen = function (index) { $scope.state.current = index; $scope.state.src = $scope.state.childrens[index].state.src; $scope.state.visible = true; }; $scope.handleClose = function () { $scope.state.visible = false; }; $scope.handlePrev = function () { $scope.state.current = $scope.state.current > 0 ? $scope.state.current - 1 : 0; $scope.state.src = $scope.state.childrens[$scope.state.current].state.src; }; $scope.handleNext = function () { $scope.state.current = $scope.state.current < $scope.state.childrens.length - 1 ? $scope.state.current + 1 : $scope.state.childrens.length - 1; $scope.state.src = $scope.state.childrens[$scope.state.current].state.src; }; $scope.handlePreview = function () { esNgAntd.createLayer( `