【问题标题】:keep the original value of radio button if the pop-up is not confirmed angular如果弹出窗口未确认角度,则保留单选按钮的原始值
【发布时间】:2020-07-29 22:16:46
【问题描述】:

如果弹出消息没有被确认,我想保留单选按钮的原始值。

我有一个功能,当单选按钮的值改变时显示弹出消息

radioChange(event: MatRadioChange) {
    this.dialogConfig = {
        autoFocus: true,
        closeOnNavigation: false,
        width: '695px',
        disableClose: true,

    };
    this.messageDialog.open(MessageDialogComponent, this.dialogConfig);
}

【问题讨论】:

    标签: html angular typescript angular8


    【解决方案1】:

    您可以在this 上保留对先前值的引用。

    this.radioButtonValue = false;
    
    

    然后在你的radioChange函数中,你可以分配你想要保留的值。

    radioChange(event: MatRadioChange) {
    
       this.radioButtonValue = MatRadioChange.target.value;
    
       this.dialogConfig = {
          autoFocus: true,
          closeOnNavigation: false,
          width: '695px',
          disableClose: true,
        };
    
        this.messageDialog.open(MessageDialogComponent, this.dialogConfig);
    
    }
    

    【讨论】:

    • 但弹窗在其他组件中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-06
    • 2013-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多