There was a problem when adding a modal window component to angular 2. A window is being created, but not a dialog.
Screen
It is added as a regular div block. What could be the problem?
app.module.ts
import { MaterialModule } from '@angular/material'; @NgModule({ declarations: [ ... DialogComponent ], imports: [ ... MaterialModule.forRoot() ] }) dialog.component.ts
import { Component, ViewContainerRef } from '@angular/core'; import { MdDialog, MdDialogConfig, MdDialogRef } from '@angular/material'; import { DialogComponent } from '../shared/dialog.component'; @Component({ moduleId: module.id, selector: 'dialog-page', templateUrl: 'dialog.component.html' }) export class SettingsComponent { dialogRef: MdDialogRef<any>; constructor(public dialog: MdDialog, public viewContainerRef: ViewContainerRef) { } open(key) { let config = new MdDialogConfig(); config.viewContainerRef = this.viewContainerRef; this.dialogRef = this.dialog.open(DialogComponent, config); this.dialogRef.afterClosed().subscribe(result => { this.dialogRef = null; }); } } 