Material: dialog: add support for temporarily minimizing/restoring with state retained

Created on 6 Oct 2017  路  6Comments  路  Source: angular/material

Actual Behavior:

  • What is the issue? * Need a way to temporarily disappear an md-dialog; hide() destroys the dialog and resolves the promise from show()
  • What is the expected behavior? A minimize() or disappear() function to temporarily hide the md-dialog

AngularJS Versions: *

  • AngularJS Version: v1.6.5
  • AngularJS Material Version: v1.1.5

Additional Information:

  • Browser Type: * Any supported
  • Browser Version: * Any supported
  • OS: * Any supported

I'm trying to allow "minimizing" (or simply hiding) an md-dialog temporarily so users can interact with the rest of the app and return to the hidden md-dialog to continue interaction at a later time.

I have attempted using ng-hide on the md-dialog, but it doesn't return control back to the SPA, and setting focusOnOpen to false seems to have no effect.

The reason I need this? My SPA is a set of md-cards that open up md-dialogs, all of which contain enough content to require opening full-screen. The md-cards interact with each other conceptually, and there are many workflows that require ping-ponging between the md-cards.

I would like to avoid nesting the contents of my entire app within each md-dialog to allow users to exploit "multiple" overlaid md-dialogs.

My plan is to simply hide the dialog and keep it in memory rather than try to store state and restore it.
Is there a recommended way to approach this?

not core

Most helpful comment

Thank you for submitting this issue and explaining your use case. However, this falls outside of the Material Design spec and what we can support in this library.

All 6 comments

+1

I had a same requirement, what I have done was used little jquery

$scop.minimize = function () {
            $('.md-dialog-container').hide();
            $('md-backdrop').hide();
        };
$scop.maximize = function () {
            $('.md-dialog-container').show();
            $('md-backdrop').show();
        };

This is indeed not a perfect solution, but this is works for me. But I am looking for a very prominent solution.

Use prerendered dialogs https://material.angularjs.org/latest/api/service/$mdDialog#pre-rendered-dialogs

@norkunas Thanks! How can I store and retrieve all state (not just variables, but GUI element states and user-entered text) within the manually-linked scope of the instantiated prerendered dialog? Should I create a hashmap of scopes for every nested dialog at the app level?

@umanda This looks very promising! Thanks.

Thank you for submitting this issue and explaining your use case. However, this falls outside of the Material Design spec and what we can support in this library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeoLozes picture LeoLozes  路  3Comments

robertmesserle picture robertmesserle  路  3Comments

rdantonio picture rdantonio  路  3Comments

sbondor picture sbondor  路  3Comments

ghost picture ghost  路  3Comments