Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Sep 26, 2014 @ 13:15
    Warren Buckley
    0

    dialogService.closeAll() & eventService app.closeDialogs

    Hello all, I am trying to close all open Dialogs after I call a function on the $rootScope to clear a drawing canvas in the main editor.

    Once the canvas is cleared I want to close any open dialogs immediately with the dialogService.closeAll(); function. However this does not close the open dialog.

    Currently the setup is as follows:
    There is an button in the main editor, that is called Edit Canvas which opens a new dialog, in this dialog there is a button called Clear Canvas which opens a second dialog on top of the Edit Canvas dialog which prompts the user are they sure they wish to clear the canvas.

    The Yes button has an ng-click function with the associated controller and is working as expected and is calling my function in the $rootScope to clear the drawing canvas. It is just the issue with the dialogService for closing the dialogs.

    I appreciate any advice or help that anyone can give me.
    Thanks

    angular.module('umbraco').controller('ecosystem.clearCanvasDialogController', function($scope, $rootScope, dialogService, eventsService) {
      //Button Click - Clear Canvas
      $scope.clearCanvas = function() {
    
       console.log('Clear Canvas clicked from Dialog');
       console.log('Root Scope', $rootScope);
    
       //Need to call clearPlumbCanvas() in the main editor controller
       $rootScope.clearPlumbCanvas();
    
    
       //Close any open dialogs (Will be both dialogs)
    
       //dialogService close all method not working
       //dialogService.closeAll();
    
       //Try using the eventService to emit event that the dialogService closeAll is listening
       eventsService.emit("app.closeDialogs");
      }
    });
    
Please Sign in or register to post replies

Write your reply to:

Draft