gpt4 book ai didi

Angular PrimeNG p-confirmDialog 显示两次

转载 作者:行者123 更新时间:2023-12-02 16:09:59 25 4
gpt4 key购买 nike

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

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

<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 包含在模块的提供者部分,ComfirmDialogModule 被导入模块的导入部分。 showConfirmDialog() 调用一次。

我错过了什么?

提前致谢

最佳答案

如果您没有提供任何 key ,您也可以通过为您的组件提供 ConfirmationService 来解决这个问题

@Component({
providers: [ConfirmationService], // <- inject the service at the component level.
selector: 'your-component',
styleUrls: ['./your.component.scss'],
templateUrl: './your.component.html',
})

关于Angular PrimeNG p-confirmDialog 显示两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68277753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com