如何根据按钮单击$uibmodalinstance js调用函数

ubof19bj  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(197)

我正在使用AngularJSUIBModal库加载表单。这是我的列表控制器列表控制器

$scope.showMoreDetails = function (id, tabstate) {
            console.log(id);
            console.log(tabstate);
            var modalInstance = $uibModal.open({
                animation: true,
                ariaLabelledBy: "modal-title",
                ariaDescribedBy: "modal-body",
                controller: "viewCtrl",
                size: 'md',
                templateUrl:
                    "modules/view-approval/view-profile-view/profile-view.html",
                resolve: {
                    appid: function () {
                        return id
                    },
                    status: function () {
                        return tabstate;
                    }

                },
            });
            modalInstance.result.then(function () {

            });
        };

这个功能运行良好。弹出页面(profile view.html)中有两个按钮

<button type="button" class="btn btn-danger btn-flat pull-right" ng-click="rejectProfile()">
    <i class="fa fa-remove"></i> <span>Reject</span>
</button>
<button type="button" class="btn btn-success btn-flat pull-right" ng-click="approveProfile()">
    <i class="ion ion-android-done-all"></i> <span>Approve</span>
</button>

弹出式控制器(viewctrl)中有两个功能

$scope.approveProfile = function(){
 approval function goes here
}

$scope.rejectProfile= function(){
 reject function goes here
}

当用户单击拒绝按钮时,我需要关闭弹出窗口并调用拒绝功能。如果单击“批准”,我需要关闭弹出窗口并调用“批准”功能。你能帮我做这个吗

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题