From 0c174d2965ae2638f95f4c9ef3124563a6326507 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Sun, 5 Feb 2017 13:17:32 +0100 Subject: [PATCH] feat(dialog): allow for the dialog dimensions to be updated Adds an `updateDimensions` method to the `MdDialogRef` which allows the user to update a dialog's dimensions after it has been created. Fixes #2930. --- src/demo-app/dialog/dialog-demo.ts | 27 +++++++++++--- src/lib/core/core.ts | 1 + src/lib/dialog/dialog-ref.ts | 28 ++++++++++++++- src/lib/dialog/dialog.spec.ts | 20 +++++++++++ src/lib/dialog/dialog.ts | 57 +++++++++--------------------- 5 files changed, 86 insertions(+), 47 deletions(-) diff --git a/src/demo-app/dialog/dialog-demo.ts b/src/demo-app/dialog/dialog-demo.ts index 5e91c097f9aa..f1bda594ec4b 100644 --- a/src/demo-app/dialog/dialog-demo.ts +++ b/src/demo-app/dialog/dialog-demo.ts @@ -57,15 +57,32 @@ export class DialogDemo { @Component({ selector: 'demo-jazz-dialog', template: ` -

It's Jazz!

-

-

{{ jazzMessage }}

- ` +

It's Jazz!

+

+

{{ jazzMessage }}

+ + + ` }) export class JazzDialog { + private _positionToggle = false; + jazzMessage = 'Jazzy jazz jazz'; constructor(public dialogRef: MdDialogRef) { } + + togglePosition(): void { + this._positionToggle = !this._positionToggle; + + if (this._positionToggle) { + this.dialogRef.updateDimensions(null, null, { + top: '25px', + left: '25px' + }); + } else { + this.dialogRef.updateDimensions(); + } + } } @@ -104,7 +121,7 @@ export class JazzDialog { color="primary" href="https://en.wikipedia.org/wiki/Neptune" target="_blank">Read more on Wikipedia - +