how to raise event from inside actionKey function ?
I am trying to do something like
$.keyboard.keyaction.plusbtn = function (base) {
this.incrementKeyPress.emit(1); // where increment key press is an event Event emmiter defined in the
// component as below
// @Output() incrementKeyPress: EventEmitter<any> = new EventEmitter();
I get an error saying " cant call emit of undefined" I understand incrementKeyPress is undefined because "this" is not a reference to the component but the keyboard. How do I call the event emmiter from here.
Hi @debanjana!
The this in the example would reference the function wrapping the code. Please share more of your code, especially the code containing incrementKeyPress so I can better help you.
Since this plugin uses jQuery, would using .trigger() work for you?
Hi Rob :) , Thank you for your reply. I kind of figured something out and I did as below :
$.keyboard.keyaction.plusbtn = function (this, base) {
// console.log('base.settings', base.settings.index);
if (base.settings.specialActionCallback) {
base.settings.specialActionCallback({ action: 'add', index: base.settings.index});
}
}
and in my parent component I did as below :
getVirtualKeyboardType(parameter: DisplayParameter) {
if (this.showNumericKeypad()) {
return {
...............
specialActionCallback: this.specialAction.bind(this),
}