Ad Reijngoudt
Ad Reijngoudt

Reputation: 126

In Material for Angular4, is it possible to open nested dialogs?

When I try to open an mdDialog from within another mdDialog, something happens on the far left side of the screen (a white panel appears). Should it be possible (by design) to open a nested dialog?

Upvotes: 1

Views: 2144

Answers (1)

slaesh
slaesh

Reputation: 16917

It's possible.

@Component({
  selector: 'app-cmp2',
  template: 'cmp2'
})
export class Cmp2 { }

@Component({
  selector: 'app-cmp1',
  template: 'cmp1<br /><button (click)="openDlg()">open second</button>'
})
export class Cmp1 {

  constructor(public mdDialog: MdDialog) { }

  public openDlg() {
    this.mdDialog.open(Cmp2);
  }
}

@Component({
  selector: 'material-app',
  templateUrl: 'app.component.html'
})
export class AppComponent {

  constructor(http: Http, public mdDialog: MdDialog) { }

  public openDlg() {
    this.mdDialog.open(Cmp1);
  }
}

http://plnkr.co/edit/ywuCW8HbsXF7To578mcX?p=preview

Maybe create a plunker to demonstrate your problem..

Recursive opening: http://plnkr.co/edit/XW2VpNvieARV40g77Rps?p=preview

Background overlay just keeps getting darker.. :)

Upvotes: 1

Related Questions