如何将 uibModal 控制器包裹在括号中以防止其缩小

How do you wrap a uibModal controller in brackets to protect it from minifying

我的模态函数在缩小时出现问题。这是因为控制器没有用括号括起来。

对于常规控制器,我会使用 " .controller('Ctrl', ['$scope', function($scope){});

但是对于我的模式,它只是调用一个直接函数:

        var modalInstance = $uibModal.open({
            animation: true,
            backdrop: 'static',
            keyboard: false,
            templateUrl: 'questionsModal.html',
            controller: function($scope, $uibModalInstance, SweetAlert) {

我尝试了以下方法:

            var modalInstance = $uibModal.open({
                animation: true,
                backdrop: 'static',
                keyboard: false,
                templateUrl: 'questionsModal.html',
                controller: ('', [ '$scope', function($scope) {}])

但是不行。

给你:

 var modalInstance = $uibModal.open({
                animation: true,
                backdrop: 'static',
                keyboard: false,
                templateUrl: 'questionsModal.html',
                controller: ['$scope', '$uibModalInstance', 'SweetAlert', function($scope, $uibModalInstance, SweetAlert) {
                 }]