I've encountered a peculiar problem with AngularJS that I need help with. Here's the situation:
Using scope.watch to monitor text changes in a text field (searchloco).
<input class="typeahead" ng-model="searchloco" data="{{varu}}" search-bar type="text">
In addition, I'm utilizing a keydown function to detect the Enter key press and I want to change location.Path upon detection.
Strangely enough, when any key other than Enter is pressed, everything works as expected - the text updates in watch, and the keydown function is triggered properly. However, when the Enter key is pressed, the keypress event fires but the watch cycle does not pick up this key. The statement "Location.path("/")" following the if statement meant to confirm an 'Enter' key also fails to execute until another key (a-z) is typed.
element.on( 'keydown' , function (e){
console.log("=== key down pressed === ",e);
if(e.which == 13){
location.path('/search/');
...
...
If my explanation isn't clear, please let me know how I can provide further clarification on this puzzling issue.