AngularJs 模态传递值

AngularJs Modal Pass Values

我正在尝试将一个值传递给弹出控制器,但只有在我将此 "havePermissions" 插入控制器时才会传递,但出现此错误 https://docs.angularjs.org/error/$injector/unpr? p0=havePermissionsProvider(未知提供者:havePermissionsProvider)

如果我删除这个“havePermissions,我没有错误,但不要将值传递给模态控制器(未定义值)

模态打开

$scope.open = function (size) {
        var modalScope = $rootScope.$new();
        modalScope.modalInstance = $modal.open({
            templateUrl: 'Views/Common/participants.html',
            controller: 'ModalInstanceCtrlPartic',
            size: size,
            scope: modalScope,
            resolve: {
                havePermissions: function () {
                    return $scope.havePermissions;
                }
            }
        });
        modalScope.modalInstance.result.then(function () {
        });
    };

模态控制器

angular.module("participants.controller", ['ui.bootstrap'])
    .controller("ModalInstanceCtrlPartic", ["$scope", "$http", "$location", 
"$routeParams", "UserService","havePermissions","logger",
            function ($scope, $http, $location, $routeParams, UserService, 
havePermissions,logger) {

            var page = $location.path().split('/')[1];
            $scope.havePermissions = havePermissions;

            $scope.ID_Event = page == "events" ? $routeParams.eventId : null;
            $scope.ID_UserGroup = page == "groups" ? $routeParams.groupId : null;
            $scope.page = page;

            $scope.model = {};

            UserService.GetParticipants($routeParams.groupId, $routeParams.eventId).then(function (response) {
                $scope.model = response.data;
            }, function (e) {
                logger.logError("Ocorreu um erro, tente novamente.!");
            });

            $scope.emailList = [];

            $scope.ok = function (list) {
                //envia email
                $scope.modalInstance.close('');
            };

            $scope.cancel = function () {
                $scope.modalInstance.close('');
            };

        }]);

$modal.open 方法不应进入新创建的范围内。 保持 var modalInstance = $modal.open({//init code})

模态代码修改如下

$scope.open = function (size) {
        var modalScope = $rootScope.$new();
        var modalInstance = $modal.open({
            templateUrl: 'Views/Common/participants.html',
            controller: 'ModalInstanceCtrlPartic',
            size: size,
            scope: modalScope ,
            resolve: {
                havePermissions: function () {
                    return $scope.havePermissions;
                }
            }
        });
        modalInstance.result.then(function () {
        });
    };

这里更新了plunkr不完全一样

希望对您有所帮助。