'use strict';

angular.module('qusion.ui.enter', [])
    .directive('qnEnter', function() {
        return function(scope, element, attrs) {
            element.bind("keypress", function(event) {
                if (event.which === 13) {
                    scope.$apply(function() {
                        scope.$eval(attrs.qnEnter);
                    });

                    event.preventDefault();
                    return false;
                }
            });
        };
    });