Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度倍数$MDD对话框_Javascript_Angularjs_Modal Dialog_Showmodaldialog_Mddialog - Fatal编程技术网

Javascript 角度倍数$MDD对话框

Javascript 角度倍数$MDD对话框,javascript,angularjs,modal-dialog,showmodaldialog,mddialog,Javascript,Angularjs,Modal Dialog,Showmodaldialog,Mddialog,我使用模式选项卡,并且我有一个通知弹出窗口,当用户登录到我的应用程序时,它总是显示给用户。它包含用户脱机时发生的所有事件。问题是,当我单击列表中的任何对象时,它会关闭弹出窗口并显示新的模式选项卡 我想归档这个功能。当用户登录时,通知弹出窗口将显示给用户,如果用户单击任何对象,它将打开另一个窗口而不关闭我的通知弹出窗口(新事件)。我想要像我在下面画的照片上那样的东西 我查看了angular material文档,但根本没有演示,甚至没有很好地解释如何使用multiple:true选项,我不知道如

我使用模式选项卡,并且我有一个通知弹出窗口,当用户登录到我的应用程序时,它总是显示给用户。它包含用户脱机时发生的所有事件。问题是,当我单击列表中的任何对象时,它会关闭弹出窗口并显示新的模式选项卡

我想归档这个功能。当用户登录时,通知弹出窗口将显示给用户,如果用户单击任何对象,它将打开另一个窗口而不关闭我的通知弹出窗口(新事件)。我想要像我在下面画的照片上那样的东西

我查看了angular material文档,但根本没有演示,甚至没有很好地解释如何使用
multiple:true
选项,我不知道如何让它像我想要的那样工作

$mdDialog

这是我用来显示通知弹出窗口的代码

//show new notifications when user log in
    NotificationService.getUnreadedNotifications(function (data) {
        //initialization
        $scope.notification = [];
        $scope.OverAllCount = 0;
        $scope.messageNotification = [];
        $scope.OverAllMessageCount = 0;

        if (data.ProjectNotifications != null) {
            angular.forEach(data.ProjectNotifications, function (key, value) {
                $scope.notification.push(key);
                $scope.OverAllCount = $scope.OverAllCount + 1;
            });
        }

        if (data.TasksNotifications != null) {
            angular.forEach(data.TasksNotifications, function (key, value) {
                $scope.notification.push(key);
                $scope.OverAllCount = $scope.OverAllCount + 1;
            });
        }

        if (data.MessageNotifications != null) {
            angular.forEach(data.MessageNotifications, function (key, value) {
                $scope.OverAllMessageCount = $scope.OverAllMessageCount + 1;
                $scope.messageNotification.push(key);
            });
        }

        popUpNotification();

        $scope.hide = function () {
            $mdDialog.hide();
        };

        $scope.cancel = function () {
            $mdDialog.cancel();
        };

        $scope.answer = function (answer) {
            $mdDialog.hide(answer);
        };

        //mark notifications as readed when user click on notification
        function popUpNotification() {
            $mdDialog.show({
                controller: NotificationController,
                templateUrl: 'app/components/templates/PopUpNotification.html',
                parent: angular.element(document.body),
                //targetEvent: ev,
                clickOutsideToClose: true,
                fullscreen: false,
                scope: $scope,
                multiple:true,
                preserveScope: true,
                onComplete: function () {
                    $scope.notificationPopUp = $scope.notification;
                }
            })
            .then(function () {

            }, function () {
                //fail
            });
        }
    });
这是用于显示用户在“新建覆盖模式”选项卡中单击的对象的详细信息的代码

        //mark notifications as readed when user click on notification
    $scope.popUpDetail = function (notification, index, ev) {
        $mdDialog.show({
            controller: NotificationController,
            templateUrl: 'app/components/templates/TaskDetailsDialog.html',
            parent: angular.element(document.body),
            targetEvent: ev,
            clickOutsideToClose: true,
            fullscreen: false,
            scope: $scope,
            multiple: true,
            preserveScope: true,
            onComplete: function () {
                //was readed => update database
                NotificationResourceService.update({ id: notification.Id }, notification);
                $scope.OverAllCount -= 1;
                $scope.notification.splice(index, 1);

                TaskService.get({ id: notification.EntityId })
                    .$promise.then(function (task) {
                        $scope.task = task;
                    });
            }
        })
        .then(function () {

        }, function () {
            //fail
        });
    }

不知怎的,我找到了解决问题的有效方法。这可能对将来的人有所帮助

工作代码:

 function popUpNotification() {
            $mdDialog.show({
                templateUrl: 'app/components/templates/PopUpNotification.html',
                clickOutsideToClose: true,
                bindToController: true,
                scope: $scope,  
                preserveScope: true,
                controller: function ($scope, $mdDialog) {
                    $scope.notificationPopUp = $scope.notification;
                    $scope.popUpDetail = function (notification, index, ev) {
                        $mdDialog.show({
                            controller: function ($mdDialog) {
                                this.click = function () {
                                    $mdDialog.hide();
                                }
                            },
                            targetEvent: ev,
                            clickOutsideToClose: true,
                            preserveScope: true,
                            autoWrap: true,
                            skipHide: true,
                            scope: $scope,
                            preserveScope: true,
                            templateUrl: 'app/components/templates/TaskDetailsDialog.html',
                            onComplete: function () {
                                TaskService.get({ id: notification.EntityId })
                                    .$promise.then(function (task) {
                                        $scope.task = task;
                                    });
                            }
                        })
                    }
                },
                autoWrap: false,
            })
        }
        });

添加
'multiple:true'
作为参数:

// From plain options
$mdDialog.show({
  multiple: true
});

// From a dialog preset
$mdDialog.show(
  $mdDialog
    .alert()
    .multiple(true)
);

从文档:

键使用
skipHide:true
作为传递到
$mdDialog.show()
的对象中的参数。我尝试过不使用multiple:true,但它仍然有效。必须将此参数传递到第二个(或第n个)对话框中。所以它看起来会像这样:

//第二个对话框
$mdDialog.show({
//一些领域
斯基菲德:没错,
//一些领域
});