title: Angular Formly, detect keycode in onKeypress
body: <p>I have an Angular Formly-based form in my Angular-SPA. In one of the fields the user can enter data with the help of a physical barcode-scanner. The scanner enters the numbers from the barcode followed by 'enter' (keycode: 13).</p>
  
  <p>When the 'enter' is entered, the form should preform an action (not a form submit-action, but an internal search to make sure the entered number doesn't already exists in the system), then the user can proceed to fill out the form.</p>
  
  <p>In vanilla javascript, its possible to do this by a simple onKeypress-event:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function checkInput(event) {
    if (event.keyCode == 13) {
      console.log("Preforming search");
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text" onKeypress="checkInput(event)"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>In Formly however, it's possible to add a property 'onKeypress', but it doesn't seem to pass the same event as vanilla javascript. This is some of my Angular Formly code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>templateOptions : {
    placeholder: "ISBN",
    onKeypress: function(model, options, _this, event) {
      console.log(model);
      console.log(options);
      console.log(_this);
      console.log(event);
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I run this code, the event-object is 'undefined', instead of being the same event as in vanilla javascript.</p>
  
  <p><strong>Is there any way to access the actual event in the onKeypress-property of Angular Formly-forms?</strong></p>
  
  <p>Cheers!</p>