How to inject parameters into an inline controller function in $uibModal

后端 未结 1 1498
北荒
北荒 2021-01-26 04:38

I\'m having a problem with $uibModal\'s open function, specifically injecting my parameters properly into an inline controller function.

Being the angularjs noob that I

1条回答
  •  余生分开走
    2021-01-26 05:24

    In-case anybody ends up here trying to figure out how to inject parameters into an inline controller, what ultimately worked is my final attempt using the extended syntax with the changes from the first update.

    var modalInstance = $uibModal.open({
        animation: false,
        templateUrl: 'app/workform/LoanActions/LoanActionOverpay.modal.html',
        controller: ['$scope', '$uibModalInstance', 'loanKeyFactory', 'loanFactory', function ($scope, $uibModalInstance, loanKeyFactory, loanFactory) {
            $scope.showOverpay = true;
            $scope.OverpayAccount = function () {
                $scope.loading = true;
                var key = loanKeyFactory.getLoanKey();
    
                loanFactory.getLoanInformation(key).then(function (response) {
                    $scope.loanType = response.LoanType;
                    $uibModalInstance.dismiss('cancel');
    
                    if ($scope.loanType == 'LineOfCredit')
                        ChooseLocLoanStatus();
                    else
                        CreatePayment(true, null);
                });
            };
            $scope.cancel = function () {
                $uibModalInstance.dismiss('cancel');
                ClearForm();
            }
        }],
        size: 'md',
        backdrop: 'static',
        keyboard: false
    })
    

    0 讨论(0)
提交回复
热议问题