typescript event emitter

The solution for “typescript event emitter” can be found here. The following code will assist you in solving the problem.

//method 1

Email:

{{email}}

//ts
export class AppComponent { 
email: String = ”;

onKey(event: KeyboardEvent) {
this.email = event.target[‘value’];
console.log(“event”, event);
}
}

//method 2

export class AppComponent {

onKey(event: KeyboardEvent) {
console.log(“This is”, event.type);
}
}

//method 3

@HostListener(“window:keypress”, [“$event”])
handleKeyboardEvent(event: KeyboardEvent) {
console.log(event);
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in