A keypress event is fired when a key is pressed and this key usually generates a character value (use input instead). https://developer.mozilla.org/en-US/docs/Web/Events/keypress
Thus, neither the value of the input field nor the value of the scope (application cycle / digest, etc.) reflect the expected value of the input.
The decision depends on your requirements. Here are some of them:
1) Use another event in the input field: change, keyup, ...
2) Use the $ event object in the listener method:
<input ng-model="NodeId_1" type="text" ng-keypress="getValue($event)"/> $scope.getValue = function (event) { console.log(event) }
3) Create an observer for your NodeId_1 value within the scope:
$scope.$watch('NodeId_1', function(newVal) { ... });
source share