Angular9具体化css模态不识别方法

Angular 9 materialize css modal not recognizing methods

我有一个 angular 9 应用程序,我正在使用 materialize-css 1.0 库将模式添加到我的应用程序中,我可以 instantiate/open 模式没有任何问题,但我的模式中有一个确认和关闭按钮,但它似乎无法识别我的 .ts 文件中的任何方法。

file.component.ts

@ViewChild('modal', { static: false }) modalElement: ElementRef;
myModal = null;

...
ngAfterViewInit() {
    this.myModal = new M.Modal(this.modalElement.nativeElement, {});
}

openModal() {
   this.myModal.open();
}

closeModal() {
   this.myModal.close();
}

confirmModal() {
   ...some logic
}
file.component.html

<div id="modal" class="modal" #myModal>
   ...
   <button onclick="confirmModal()">confirm</button>
</div>
 

当我打开模态并单击模态内的确认按钮时,出现引用错误:

confirmModal is not defined at HTMLButtonElement.onclick

我使用了错误的符号 onclick,它是 (click)