-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dialog): add events (observables) for open & closeAll #2522
feat(dialog): add events (observables) for open & closeAll #2522
Conversation
Browserstack build failing on iPhone 6s. Don't get it why ... does someone have a hint/tip for me? EDIT: Now green |
@thomaspink I restarted your build now, and it's now green. |
@devversion thank you. what was the problem? |
@thomaspink This sometimes happens when too many builds run at the same time. #2523 |
Good to know, thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thomaspink sorry for the review delay, we're a bit backlogged after the holidays.
Overall I think this is a useful feature. Could you rebase on current master? We've made some changes recently to the way that MdDialog
maintains state; if there is an ancestor MdDialog
instance, it defers its state to that ancestor.
@@ -59,6 +68,20 @@ export class MdDialog { | |||
} | |||
|
|||
/** | |||
* Gets an observable that is notified when a dialog has been opened. | |||
*/ | |||
afterOpen(): Observable<any> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is okay to just be a property rather than a method (in hindsight we shouldn't have made the afterClosed
on the ref a method and will be changing it).
private _afterAllClosed: Subject<any> = new Subject(); | ||
|
||
/** Subject for notifying the user that a dialog has opened. */ | ||
private _afterOpen: Subject<any> = new Subject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be Subject<MdDialogRef<any>>
@@ -22,6 +24,12 @@ export class MdDialog { | |||
/** Keeps track of the currently-open dialogs. */ | |||
private _openDialogs: MdDialogRef<any>[] = []; | |||
|
|||
/** Subject for notifying the user that all open dialogs have finished closing. */ | |||
private _afterAllClosed: Subject<any> = new Subject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one would be Subject<void>
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
939e7c3
to
4947b0b
Compare
CLAs look good, thanks! |
f95a58d
to
95f0e01
Compare
@jelbourn thanks for the feedback. Should i also change the I am also not that happy with the name |
private _afterAllClosed = new Subject<void>(); | ||
|
||
/** Subject for notifying the user that a dialog has opened. */ | ||
private _afterOpen = new Subject<MdDialogRef<any>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _afterAllClosed
and _afterOpen
subjects need to delegate to the state of the _parentDialog
if there is one (the same way that _openDialogs
does. This is because the application may contain multiple MdDialog
instances at different points in the tree.
@@ -1,4 +1,5 @@ | |||
import {Component} from '@angular/core'; | |||
import { Component, Inject } from '@angular/core'; | |||
import { DOCUMENT } from '@angular/platform-browser'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omit spaces from inside import braces
…ntDialog & removed spaces from inside import braces
a920858
to
8e45d31
Compare
@jelbourn implemented as suggested :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds Observables to NgDialog for open and closeAll.
Useful if you want to execute logic when a dialog opens or when all dialogs are closed. E.g. adding or removing a
no-scroll
class to the body, ...