if(keyEvent.keyCode == 8){
$scope.erase();
}
else if(keyEvent.keyCode === 107){
console.log("+");
$scope.inputToCal('+')
}
else if(keyEvent.keyCode === 109){
console.log("-");
$scope.inputToCal('-')
}
else if(keyEvent.keyCode === 16){
console.log("*");
$scope.inputToCal('*')
}
}
else if(keyEvent.keyCode === 111){
console.log("/");
$scope.inputToCal('/')
}
I attempted to create a calculator that captures keydown events.
I am able to capture the keys for addition, subtraction, and division.
The key codes for these operations are "107," "109," and "111" respectively.
Despite this success, there is one issue I encountered.
The key "*" cannot be captured.
Is there a solution to this problem?
Alternatively, do I need to create a new array to capture the keys "Shift" (keyCode:16) and "8" (keyCode:56)?
I apologize for my lack of expertise in handling keyEvents. I eagerly await a solution... Please assist me!