I am new to Angular JS. So I decided to start doing a small to-do Task Project. But in between, I encountered an error:
typeerror $event is undefined
I am using enterAgain
function. We need to double click for editing an existing task. After editing and upon clicking enter button, I am getting the above error.
When I checked in Google, I cam to know that we need to pass the event as function variable. So I passed the variable in enterAgain
Function. You can see that in the below files. But even though I passed the variable event, still showing error.
Please see the code attached:
https://pastebin.com/uBXDjzAH https://pastebin.com/Qz5yCQ0m
Please see the image:
Please help me to find a solution for the same.
Answer
You are not passing $event to function contentEdit($event) inside enterAgain method call.
$scope.enterAgain = function($event,msg) { if($event.which == 13 && msg !== "") { $scope.contentEdit($event); // ==> Here you need to pass $event } } });
Please check here working code : https://plnkr.co/edit/LiR4bajk0uxMH0mso2yY