如何在Typescript附加的html按钮中调用click事件?

问题描述 投票:0回答:1

我有一个在打字稿中的html中创建的按钮。我添加了一个名为btnCancelNewClientAppointment的单击函数,但未调用该函数。我该怎么办?

 let dialogObj: Dialog = (document.querySelector('.e-schedule-dialog') as EJ2Instance).ej2_instances[0] as Dialog;

  dialogObj.footerTemplate ='<div>' +  
  '<button id="saveButton" #saveSavedClientButton class="e-control e-btn e-primary sendButton" data-ripple="true">Kaydet</button>' +
  '<button id="cancelButton" #btnCancelNewClientAppointment class="e-control e-btn" data-ripple="true" (click)="btnCancelNewClientAppointment()">İptal</button>'+  
  '</div>' 


 btnCancelNewClientAppointment():void{
    let dialogObj: Dialog = (document.querySelector('.e-schedule-dialog') as EJ2Instance).ej2_instances[0] as Dialog;
    dialogObj.hide();
  }
angular angular8 syncfusion
1个回答
0
投票

我们已经检查了您报告的问题,我们怀疑问题的原因是正确检查了click函数,您可能会给函数名和一些变量名相同。因此,更改函数名称。请找到以下代码片段:

凯特+

<button id="cancelButton" #btnCancelNewClientApp class="e-control e-btn" data-ripple="true" (click)="btnCancelNewClientAppointment()">İptal</button>

请为报告的问题找到以下链接:https://github.com/ngx-formly/ngx-formly/issues/661

为方便起见,我们准备了样品。请找到以下示例链接样本链接:https://stackblitz.com/edit/angular-h8cqlw?file=app.component.html

如果您在此方面需要进一步的帮助,请检查上面的样本并与我们联系?

问候,

Saranya D

© www.soinside.com 2019 - 2024. All rights reserved.