Ng-keypress in angularjs is not working?

My code is like below.

ng-keypress= "randomEvent($event)"
$scope.randomEvent= function($event){
        if(event.which == 13 || event.keyCode == 13){
            //Code goes here
        }
    }

It is working in the chrome but not in the Firefox.
Error: event is not defined.

Hey @phani,

Your second and third references to the event are wrong… they should be $event not event.

Thank you :-).
small logic = big mistake

It is working I local but not after hosting it is not working in the Firefox

Are you getting any errors in the FF console?

yes $event is undefined

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.