I followed this example Submit form on pressing Enter with AngularJS
but I cannot get it to work. It is totally baffling. Why does the keypress event not get trapped by my directive?
http://plnkr.co/edit/A9oio2F61yHssE49aiCb?p=preview
app.directive('enterKey', function($log) {
    return function(scope, element, attrs) {
        element.bind("keydown keypress", function(event) {
            if(event.which === 13) {
                scope.$apply(function(){
                    scope.$eval(attrs.ngEnter, {'event': event});
                });
                event.preventDefault();
            }
        });
    };
});
 
     
    