JSFiddle - React, Tailwind, and code Playground

by Evan Sharp

HTML

<div ng-controller="myCtrl">
    <form>
    <input ng-model="myfield" ng-keypress="handleKeypress($event,myfield)" />
        {{myfield}}
  </form>
</div>

JavaScript

var myApp = angular.module('app',[]);

function myCtrl($scope,$sce){
    $scope.handleKeypress = function(ev,value){

      console.log(ev.target.value, $scope.myfield, value); //always one keystroke behind

      //$timeout(function(){console.log(ev.target.value);}); //works!         
    };
}