回答

1

定义shared.service其中输入值传递给父组件:

import {Injectable } from '@angular/core'; 
import { Subject } from 'rxjs'; 

@Injectable() 
export class SharedService{ 
    public triggerParentMethod: Subject<string> = new Subject<string>(); 
} 

在你ParentComponent,订阅triggerParentMethod在构造:

constructor(private sharedService:SharedService,public dialog: MdDialog){ 
    this.sharedService.triggerParentMethod.subscribe(someValueFromDialog =>{ 

     // Pass the value to the method here. 
     this.someMethod(someValueFromDialog); 

     }); 
} 

绑定您<md-input>一些[(ngModule)]

您可以发出从你的对话框,输入值是这样的:

this.sharedService.triggerParentMethod.next(this.someField); 

链接working demo