docs(dialog): Add note about AOT compilation. (#3272)

Fixes #2686.
This commit is contained in:
Topher Fangio
2017-03-01 11:24:26 -06:00
committed by Kara
parent cb57660981
commit 7a40ec7fad
2 changed files with 32 additions and 1 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ export class ComponentPortal<T> extends Portal<ComponentRef<T>> {
/**
* [Optional] Where the attached component should live in Angular's *logical* component tree.
* This is different from where the component *renders*, which is determined by the PortalHost.
* The origin necessary when the host is outside of the Angular application context.
* The origin is necessary when the host is outside of the Angular application context.
*/
viewContainerRef: ViewContainerRef;
+31
View File
@@ -46,3 +46,34 @@ You can control which elements are tab stops with the `tabindex` attribute
```html
<button md-button tabindex="-1">Not Tabbable</button>
```
### AOT Compilation
Due to the dynamic nature of the `MdDialog`, and its usage of `ViewContainerRef#createComponent()`
to create the component on the fly, the AOT compiler will not know to create the proper
`ComponentFactory` for your dialog component by default.
You must include your dialog class in the list of `entryComponents` in your module definition so
that the AOT compiler knows to create the `ComponentFactory` for it.
```ts
@NgModule({
imports: [
// ...
MaterialModule
],
declarations: [
AppComponent,
ExampleDialogComponent
],
entryComponents: [
ExampleDialogComponent
]
providers: [],
bootstrap: [AppComponent]
})
export class AppModule() {}
```