From 3367de9c50574a4aac61b51d06ddd1503295bdfb Mon Sep 17 00:00:00 2001 From: Rudolf Olah Date: Sat, 20 Jul 2019 16:02:12 -0400 Subject: [PATCH] docs(dialog): move up entry components section --- src/material/dialog/dialog.md | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/material/dialog/dialog.md b/src/material/dialog/dialog.md index ac3038fba7f4..53fa94667b44 100644 --- a/src/material/dialog/dialog.md +++ b/src/material/dialog/dialog.md @@ -39,6 +39,37 @@ export class YourDialog { } ``` +### Configuring dialog content via `entryComponents` + +Because `MatDialog` instantiates components at run-time, the Angular compiler needs extra +information to create the necessary `ComponentFactory` for your dialog content component. + +For any component loaded into a dialog, you must include your component class in the list of +`entryComponents` in your NgModule definition so that the Angular compiler knows to create +the `ComponentFactory` for it. + +```ts +@NgModule({ + imports: [ + // ... + MatDialogModule + ], + + declarations: [ + AppComponent, + ExampleDialogComponent + ], + + entryComponents: [ + ExampleDialogComponent + ], + + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule {} +``` + ### Specifying global configuration defaults Default dialog options can be specified by providing an instance of `MatDialogConfig` for MAT_DIALOG_DEFAULT_OPTIONS in your application's root module. @@ -109,37 +140,6 @@ You can control which elements are tab stops with the `tabindex` attribute -### Configuring dialog content via `entryComponents` - -Because `MatDialog` instantiates components at run-time, the Angular compiler needs extra -information to create the necessary `ComponentFactory` for your dialog content component. - -For any component loaded into a dialog, you must include your component class in the list of -`entryComponents` in your NgModule definition so that the Angular compiler knows to create -the `ComponentFactory` for it. - -```ts -@NgModule({ - imports: [ - // ... - MatDialogModule - ], - - declarations: [ - AppComponent, - ExampleDialogComponent - ], - - entryComponents: [ - ExampleDialogComponent - ], - - providers: [], - bootstrap: [AppComponent] -}) -export class AppModule {} -``` - ### Accessibility By default, each dialog has `role="dialog"` on the root element. The role can be changed to `alertdialog` via the `MatDialogConfig` when opening.