0

I have a dialog that can be closed by a snackbar. My code closes the dialog, but I need to move the mouse to get it. So I guess that somehow the view is stuck.

private save(element: myModel) {

  this.myService.save(element).then(() => {
      this.snackBar.open('saved','ok', {duration: 1000})
      .afterDismissed().subscribe(() => {
        this.dialogRef.close(element.id);
      })
    );
  });
}

How can I get it just closed without the needed of moving the mouse?

cucuru
  • 3,456
  • 8
  • 40
  • 74

1 Answers1

1

You might want to try using deley operator:

    this.snackBar
      .open('saved', 'ok', { duration: 1000 })
      .afterDismissed()
      .pipe(delay(0))
      .subscribe(() => this.dialogRef.close())
Rafi Henig
  • 5,950
  • 2
  • 16
  • 36