How to use ng-bind with the document.addEventListener() in AngularJS?

Need to make a hotkey for a page in AngularJS. Used for this document.addEventListener()method keyDownTextField() sets the value of the variable wordToShow:

export class listenKey {

 constructor() {
 document.addEventListener("keydown", (e) => this.keyDownTextField(e), false);

 keyDownTextField(e: any) {
 var keyCode = e.keyCode;

 this.wordToShow = "Hello world!";

 logKey(key: any) {
 console.log( key );

<div ng-click="$ctrl.logKey()" ng-bind="$ctrl.wordToShow"></div>

The problem is that ng-bind works only when the user clicks on div'from not working when addEventListener registers a keystroke. How to fix it?
June 10th 19 at 16:00
0 answer

Find more questions by tags AngularHTMLJavaScript