繁体   English   中英

Kendo ui用于angular:将kendoButton的click事件绑定到组件中变量的方法

[英]Kendo ui for angular: bind click event of kendoButton to a method of a variable in the component

我有一个类型为“ any”的组件变量“消息”,其中包含方法“ actionnowrapper()”

每当我绑定到如下所示的按钮时,此方法就可以很好地工作。

<button (click)="message.actionnowrapper()"></button>

每当我使用kendoButton指令时,此功能就不再起作用。

<button kendoButton (click)="message.actionnowrapper()"></button>

将Kendobutton直接绑定到组件中的方法可以解决问题,但这不是我们所需要的。

 <button (click)="actionnowrapper()"></button>

如何将kendobutton绑定到组件变量中的方法?

谢谢!

常规按钮和Kendo按钮单击处理程序的工作方式相同:

<button kendoButton (click)="message.actionnowrapper('kendo')">Click</button>
<button (click)="message.actionnowrapper('regular')">Click</button>

export class AppComponent {
message = {
  actionnowrapper: (buttonType: string) => {
      alert(`${buttonType} button clicked`)
    } 
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM