0

I am making an Angular 12 application, and I need change ngModel value via global/window method. (Because Android Webview can call from kotlin only public javascripts methods)

I'm tried use bind, and angular service. Method is called correctly, but ngModel not changed - input not filled.

Via bind, see on Stackblitz, or via service, see on Stackblitz too.

Unfortunately, the input is not filled in in any case. You can try on Stackblitz, via browser console.

So I need to update the ngModel value, but how?

Ajtak
  • 3
  • 2

1 Answers1

0

You can fire a custom event as mentioned in this answer

I've updated your code to use custom event here StackBlitz

From console tab,

window.dispatchEvent(new Event('custom-event'));
Phalgun
  • 1,181
  • 2
  • 15
  • 42