tangosource/tangoestimate

View on GitHub
client/app/ngEnter/ngEnter.directive.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

angular.module('pokerestimateApp')
.directive('ngEnter', function () {
  return function(scope, element, attrs) {

    element.bind("keydown keypress", function(event) {
      if(event.which === 13) {
        scope.$apply(function(){
          scope.$eval(attrs.ngEnter);
        });
        event.preventDefault();
      }
    });
  };
});