MdDialog - reuse the component instead of creating every time

53 views Asked by At

Is it possible to re-use the component instance used for MdDialog?

I use it this way, and it always gets re-created:

openLocationPicker() {
  const dialogParams: UserPickLocationDialogParams = {
    locationName: this.locationName,
    geoLocationString: this.latitudeLongitudeControl.nativeElement.value
  }
  let dialogRef = this.dialog.open(UserPickLocationComponent, {
    height: '470px',
    width: '600px',
    data: dialogParams
  }).afterClosed().subscribe(returnVal => {
     // ...
  })
}

I would like to re-use existing instance, because it holds agm (Google Map), and the app gets slower and slower after each opening of the dialog (looks like a resource leak).

0

There are 0 answers