Copied to clipboard

Flag this post as spam?

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


  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Aug 25, 2016 @ 12:20
    Michaël Vanbrabandt
    0

    Close dialog from another controller

    Hi,

    I am opening a new dialog using the following code:

    dialogService.open({
                    template: '/App_Plugins/uContentMap/views/dialogs/ucontentmap.node.delete.html',
                    dialogData: nodeId
                });
    

    This opens the dialog.

    Inside the view I have a button called Close that needs to close the current dialog.

    But how do I close this dialog inside my controller located in the view?

    View:

    <div ng-controller="uContentMap.Nodes.DeleteController" ng-init="init(dialogData)" class="umb-modalcolumn ng-cloak">
    
        <div class="umb-modalcolumn-header">
            <h1>Delete</h1>
        </div>
    
        <div class="umb-modalcolumn-body">
            <div class="umb-dialog umb-pane">
                <div class="umb-dialog-body">
                    <p class="umb-abstract">Are you sure you want to delete <strong>{{vm.Content.Name}}</strong>?</p>
    
                    <div class="umb-pane btn-toolbar umb-btn-toolbar">
                        <div class="control-group umb-control-group">
                            <a href ng-click="closeDialog()" class="btn btn-link">Cancel</a>
                            <a href ng-click="deleteNode()" class="btn btn-primary">OK</a>
                        </div>
                    </div>
                </div>
            </div>
    
        </div>
    
    </div>
    

    /Michaël

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Aug 25, 2016 @ 13:32
    Michaël Vanbrabandt
    100

    ok solved it by looking into the source code of Umbraco.

    Just use the close() function instead of creating your own one.

    /Michaël

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Aug 25, 2016 @ 13:35
    Michaël Vanbrabandt
    0

    And to close it after submit just call $scope.submit() in your controller

    /Michaël

Please Sign in or register to post replies

Write your reply to:

Draft