I am using dialog box of angular material2.
I want to pass data to the opened component. Here is how I am opening dialog box on click of a button
let
If you're using dialogs for HTTP data, remember RxJS and Observables is perfect for this issue.
Dialog service:
private _dialogDataSubj$ = new Subject();
dialogData$ = this._dialogDataSubj$.asObservable()
setDialogData(data: DialogData) {
this._dialogDataSubj$.next(data)
}
In dialog HTML:
I'm not sure if it's just me, but i couldn't update data in my material dialog with just dialog data reference (@Inject) ie.: dialogRef.data = newData.