1

If I have an inputelement and I with pure javascript would do something like this:

document.getElementById('myElement').value = 'Potato';

Then the form validation and change detection in Angular 2 wouldn't trigger. However, if I would have type that value in the input field, it triggers.

How can I setup my form validation and change detection in Angular 2 so that they trigger no matter how the input receives its text, whether it be by keyboard, pasting with a mouse, adding text programatically as the code above?

Weblurk
  • 6,562
  • 18
  • 64
  • 120
  • Did you try `dispatchEvent('input'`? http://stackoverflow.com/questions/2856513/how-can-i-trigger-an-onchange-event-manually – yurzui Mar 17 '17 at 14:43
  • See also http://stackoverflow.com/questions/38557175/angular2-and-jquery-change-events/38560025#38560025 – yurzui Mar 17 '17 at 14:56

0 Answers0