【问题标题】:Angular PrimeNG p-confirmDialog display twiceAngular PrimeNG p-confirmDialog 显示两次
【发布时间】:2021-09-17 12:15:48
【问题描述】:

确认对话框显示两次是什么情况? 或者其他方面,确认对话框显示两次是什么原因?

我有一个简单的对话框模板

<p-confirmDialog icon="fa fa-exclamation-triangle"
                 width="444"
                 [closable]="false"
                 key="uniqueidofdialog"
                 appendTo="body"
                 #dialogref>
  <p-footer>
    <button id="gemini_consentLockedByAnotherUser_btnOk"
            type="button"
            pButton
            class="button-primary"
            label="OK"
            (click)="dialogref.accept()"></button>
  </p-footer>
</p-confirmDialog>

  private showConfirmDialog() {
    this.confirmationService.confirm({
      message: `Warning! blah-blah.`,
      header: `Warning header`,
      key: 'uniqueidofdialog',
      accept: () => {
        // TODO
      }
    });     
  }

当然 ComfirmationService 包含在模块的 provider 部分,而 ComfirmDialogModule 被导入到模块的 import 部分。 showConfirmDialog() 调用一次。

我错过了什么?

提前谢谢你

【问题讨论】:

    标签: angular dialog primeng display


    【解决方案1】:

    这个问题通常是当多个确认对话框具有相同的键时引起的。因此请确保您的键对于您的对话框是唯一的。我看到你已经完成了......只需仔细检查你的代码库中所有现有的确认对话框

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-07
      • 2019-06-22
      • 1970-01-01
      • 1970-01-01
      • 2018-08-28
      • 2021-01-25
      • 1970-01-01
      相关资源
      最近更新 更多