Skip to content

Commit

Permalink
docs(dialog): Add note about AOT compilation.
Browse files Browse the repository at this point in the history
Add a note to the `MdDialog` documentation discussing proper usage
with the Ahead of Time compiler.

Also fix a small typo in the Portal docs.

Fixes #2686.
  • Loading branch information
topherfangio committed Feb 23, 2017
1 parent c203589 commit 61c3644
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 it's 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.forRoot()
],

declarations: [
AppComponent,
ExampleDialogComponent
],

entryComponents: [
ExampleDialogComponent
]

providers: [],
bootstrap: [AppComponent]
})
export class AppModule() {}
```

0 comments on commit 61c3644

Please sign in to comment.