I am implementing an md-dialag from Material Design on my Angular 4 application. I have currently achieved to pass data into the modal, but have not been successful to retrieve any data entered by the user on the dialog.
This is how I open a dialog:
ShowAddStop() {
this.general = {fc: this.locationCtrl, fl: this.filteredLocations, selectedNewStop:this.selectedNewStop};
let dialogRef = this.dialog.open(DialogAddStop,{data:this.general});
dialogRef.afterClosed().subscribe(result => {
console.log(result);
});
}
But for instance, on the dialog I have an input field which I want the user to fill:
<input [(ngModel)]="ShortName">
Where Shortname is a variable on the class from where I called the dialog, it won't change that variable, I think it creates its own scope and that's why it isn't using my class instance variables.
Is there something basic I'm missing on retrieving data back from the dialog?