Widgets events
-
Specify the version of the devextreme-angular and devextreme packages you are using. devexteme version: 17.1.7 devextreme-angular version: 17.1.7
-
Specify the type of the issue (check one with "x"): [ ] bug Report [ ] feature request [ ] support inquiry
Hi, if I handle a widget event in the template (i.e. onKeyUp):
<dx-text-box #dxTextBox (onKeyUp)="firstHandler($event)"></dx-text-box>
And by code:
dxTextBox.onKeyUp = secondHandler;
I get both handlers working. But if I remove the template handler then the code handler doesn't work.
I can solve it like this but I'd like to know why this is necessary and if I can do it in another way without modiying the template:
<dx-text-box #dxTextBox (onKeyUp)="void"></dx-text-box>
Thanks!
onKeyUp is an event, i.e., it's an output. It's incorrect to assign a function to it. You need to subscribe to an event to handle it in code:
this.txt.onKeyUp.subscribe((evnt) => {
console.log(evnt);
});
This issue is closed because of being inactive. If you need further assistance, leave a comment here.