Angular 当用户在弹出窗口中选择“否”时,将变量设置为null

Angular 当用户在弹出窗口中选择“否”时,将变量设置为null,angular,Angular,我正在尝试修复其他人代码中的错误。我是个新手。 当用户点击链接按钮时,我试图打开一个弹出窗口。当用户单击名为“拒绝”的链接按钮时,他会收到一条确认信息,说明您确定要拒绝。如果单击“是”按钮,则会打开弹出窗口。以下是“是”和“否”问题的代码: <div *ngIf="VerifyBatch.PromptStopEnvelope == true"> <span> <i class="fa fa-exclamation-triangle fa-2x"

我正在尝试修复其他人代码中的错误。我是个新手。 当用户点击链接按钮时,我试图打开一个弹出窗口。当用户单击名为“拒绝”的链接按钮时,他会收到一条确认信息,说明您确定要拒绝。如果单击“是”按钮,则会打开弹出窗口。以下是“是”和“否”问题的代码:

<div *ngIf="VerifyBatch.PromptStopEnvelope == true">
    <span>
      <i class="fa fa-exclamation-triangle fa-2x" aria-hidden="true">
        <span class="information">
          Are you sure you want to {{VerifyBatch.EnvelopeStopAction}} Envelope {{VerifyBatch.SelectedMail.MailNumber}} ?
        </span>
      </i>
    </span>
    <span>
      <button class="appHighPriorityBtn" (click)="InitSelectedMail();VerifyBatch.PromptStopEnvelope = false;openDialog(VerifyBatch.SelectedMail, VerifyBatch.EnvelopeStopAction, 'Envelope')">
        YES
      </button> &nbsp;
      <button class="appBtnConfirmation" (click)="InitSelectedMail();VerifyBatch.PromptStopEnvelope = false">
        NO
      </button>
    </span>
  </div>
在我的组件文件中,消息将消失,但我不确定为这两个变量指定null的函数。下面是我的部分组件代码:

Component({
    selector: 'detach-dialog',
    templateUrl: './detachreason.dialog.component.html',
})
export class DetachDialogComponent {

    constructor(
        public dialogRef: MatDialogRef<DetachDialogComponent>,
        @Inject(MAT_DIALOG_DATA) public data: any) { dialogRef.disableClose = true; }

    onNoClick(): void {
      this.dialogRef.close();

  }

}

@Component({
    selector: 'app-verifybatch',
    templateUrl: './verifybatch.component.html'
})

export class VerifybatchComponent implements OnInit {

 openDialog(mailOrItem, action: string, itemType: string): 

// some variables are assigned here

dialogRef.afterClosed().subscribe(result => {
         // this.RefreshScreen();
          this.MailValidationErrors = null;
          if (result != null) {

        // code here
组件({
选择器:“分离对话框”,
templateUrl:'./detachreason.dialog.component.html',
})
导出类组件{
建造师(
公共dialogRef:MatDialogRef,
@注入(MAT_DIALOG_DATA)公共数据:any){dialogRef.disableClose=true;}
onNoClick():void{
this.dialogRef.close();
}
}
@组成部分({
选择器:“应用程序验证批处理”,
templateUrl:“./verifybatch.component.html”
})
导出类VerifybatchComponent实现OnInit{
openDialog(mailOrItem,action:string,itemType:string):
//这里分配了一些变量
dialogRef.afterClosed().subscribe(结果=>{
//这个。刷新屏幕();
this.mailvalidateErrors=null;
如果(结果!=null){
//代码在这里
任何帮助都将受到高度赞赏

 this.dialogRef.close(valueToReturnFromDialog);
Component({
    selector: 'detach-dialog',
    templateUrl: './detachreason.dialog.component.html',
})
export class DetachDialogComponent {

    constructor(
        public dialogRef: MatDialogRef<DetachDialogComponent>,
        @Inject(MAT_DIALOG_DATA) public data: any) { dialogRef.disableClose = true; }

    onNoClick(): void {
      this.dialogRef.close();

  }

}

@Component({
    selector: 'app-verifybatch',
    templateUrl: './verifybatch.component.html'
})

export class VerifybatchComponent implements OnInit {

 openDialog(mailOrItem, action: string, itemType: string): 

// some variables are assigned here

dialogRef.afterClosed().subscribe(result => {
         // this.RefreshScreen();
          this.MailValidationErrors = null;
          if (result != null) {

        // code here
 this.dialogRef.close(valueToReturnFromDialog);