-
Notifications
You must be signed in to change notification settings - Fork 6.8k
docs(demos): add dialog demos #5666
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
Conversation
When merged, will need to ensure this is merged at same time - angular/material.angular.io#216 |
@crisbeto should also take a look |
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.
A few nitpicks.
templateUrl: 'dialog-basic-example.html', | ||
}) | ||
export class DialogBasicExample { | ||
constructor(public dialog: MdDialog) {} |
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 doesn't need to be public.
<md-dialog-content>Are you sure?</md-dialog-content> | ||
<md-dialog-actions> | ||
<button md-button tabindex="-1">Not Tabbable</button> | ||
<button md-button [md-dialog-close]="true" tabindex="1">Yes</button> |
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.
A more realistic example for this case would be to have an input and have the md-dialog-close
pass the input value back to the afterClosed
.
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.
@crisbeto - I have this demo in the overview, do you think we need to do it here too?
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.
Sorry, I must've missed the one below.
<p> Hi, I'm a dialog! </p> | ||
<h1 md-dialog-title>Hi {{data.name}}</h1> | ||
<div md-dialog-content> | ||
<p>Whats your favorite animal?</p> |
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.
Whats
-> What's
.
<ol> | ||
<li> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="name" placeholder="Whats your name?"> |
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.
Whats
-> What's
.
<li *ngIf="animal"> | ||
You chose: <i>{{animal}}</i> | ||
</li> | ||
</ol> |
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.
Missing trailing newline at the end of the file.
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.
Odd that linting isn't picking this up.
@@ -40,7 +40,8 @@ import { | |||
MdToolbarModule, | |||
MdTooltipModule, | |||
MdPaginatorModule, | |||
MdSortModule | |||
MdSortModule, | |||
MdTableModule |
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.
Looks like this adds MdTableModule
for a second time (it's already defined on line 39).
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
openDialog() { | ||
this.dialog.open(DialogDataExampleDialog, { | ||
data: { | ||
animal: 'panda' |
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 data should come from an <input>
next to the dialog open button, to demonstrate the value coming from the user.
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.
Per our conversation, we discussed using the example of the overview to demonstrate this and keeping this demo basic.
/** | ||
* @title Dialog Content | ||
*/ | ||
@Component({ |
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.
"Dialog content" by itself doesn't really communicate what this example is for. It should be something like
"Dialog with header, scrollable content, and actions". The content should be long enough to cause scrolling and wide enough that the actions are aligned to either the right or left of the dialog.
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.
I addressed the scrolling and title, can you expand on what you had in mind for the button alignment?
import {MdDialog, MD_DIALOG_DATA} from '@angular/material'; | ||
|
||
/** | ||
* @title Dialog Data Sharing |
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.
I'd call this "Injecting data when opening a dialog"
src/lib/dialog/dialog.md
Outdated
@@ -1,7 +1,7 @@ | |||
The `MdDialog` service can be used to open modal dialogs with Material Design styling and | |||
animations. | |||
|
|||
<!-- example(dialog-overview) --> | |||
<!-- example(dialog-basic) --> |
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.
Is this supposed to be dialog-overview
?
I think we should probably get rid of this "dialog-basic" example because it is too basic; it doesn't really show anything. The first example really needs to showcase the component.
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.
Done. Moved the first demo to the complex overview example.
Also, nothing really highlights returning data from the dialog like we have now. I think this should be featured more predominantly. In removing |
@jelbourn - Already done, see comment above referencing the PR - angular/material.angular.io#216 |
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
@amcdnl lint error
|
It would be great to share an example with async data and how to share data. |
@amcdnl you can add the "merge_ready" label back after fixing the lint warning |
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 demos for: