Skip to content

Commit

Permalink
docs(dialog): Add note about AOT compilation. (#3272)
Browse files Browse the repository at this point in the history
Fixes #2686.
  • Loading branch information
topherfangio authored and kara committed Mar 1, 2017
1 parent cb57660 commit 7a40ec7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/core/portal/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
31 changes: 31 additions & 0 deletions src/lib/dialog/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
```

0 comments on commit 7a40ec7

Please sign in to comment.