2
예 및 아니오 옵션 (확인 상자)이있는 대화 상자가 있습니다. 나는 사용자가 대화 상자에서 예 또는 아니오 버튼을 누를 때까지 기다리기를 원하지만, 대화 상자의 옵션을 클릭하기 전에 버튼을 클릭 할 때까지 콘솔 로그는 초기/빈 문자열을 인쇄합니다.MD 대화 상자 재질 각도 2 닫기 대기
HTML :
<button (click)="foo()"></button>
구성 요소 :
selectedOption = '';
foo() {
this.openDialog();
console.log('selectedOption: ' + this.selectedOption); // Prints initial Value
// hit the API if selectedOption is yes.
}
openDialog() {
dialogRef.afterClosed().subscribe(result => {
this.selectedOption = result;
});
}