AnimationAwareDialog
Decorators: |
|
Extends: | Dialog |
Tweaked version of the Dialog
service from Angular CDK that supports leaving animations by waiting for animations to complete before disposing the overlay.
See Also
Properties
Name | Type | Description |
---|---|---|
afterAllClosed r inherited from Dialog |
| Stream that emits when all open dialog have finished closing. Will emit on subscribe if there are no open dialogs to begin with. |
Accessors
get afterOpenedinherited from Dialog |
---|
Stream that emits when a dialog has been opened. |
Presentation
|
Type |
get openDialogsinherited from Dialog |
---|
Keeps track of the currently-open dialogs. |
Presentation
|
Type
|
Methods
closeAll()inherited from Dialog | ||||
---|---|---|---|---|
Closes all of the currently-open dialogs. | ||||
Presentation
| ||||
Returnsvoid | ||||
|
getDialogById()inherited from Dialog | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Finds an open dialog by its id. | ||||||||||
Presentation
| ||||||||||
Parameters
ReturnsDialogRef<R, C> | undefined | ||||||||||
|
ngOnDestroy()inherited from Dialog | ||||
---|---|---|---|---|
No documentation has been provided. | ||||
Presentation
| ||||
Returnsvoid | ||||
|
open()overrides Dialog | |||||||||
---|---|---|---|---|---|---|---|---|---|
Opens a modal dialog containing the given component. | |||||||||
Presentation
| |||||||||
Parameters
ReturnsDialogRef<R, C> -Reference to the newly-opened dialog. |
Example usage
provide ({ token: Dialog, useClass: AnimationAwareDialog })
Usage Notes
Currently, when closing a dialog, the corresponding overlay is immediately disposed, which means that the host element of the overlay is immediately removed from the DOM using the native API.
The current behavior completely eliminated the possibility to implement a :leave
animation for dialogs, since the ancestor element of the dialog, the overlay, is removed via the native DOM API, and the Angular animation engine cannot hook into this process to perform the :leave
animation.
This class works around the issue by waiting :leave
animations to complete before disposing the overlay.