File: src/packages/common/components/util/directives/enterDirective.js

Recommend this page to a friend!
  Classes of Alien Fernandez   Seed Sails Angular   src/packages/common/components/util/directives/enterDirective.js   Download  
File: src/packages/common/components/util/directives/enterDirective.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Seed Sails Angular
Full stack framework based on Sails, Node, Angular
Author: By
Last change: Update of src/packages/common/components/util/directives/enterDirective.js
Date: 3 years ago
Size: 569 bytes
 

Contents

Class file image Download
import commonModule from '../../../commonModule'; class NgEnterDirective { /*ngInject*/ constructor() { return (scope, element, attrs) => { element.bind("keydown keypress", (event) => { if (event.which === 13) { scope.$apply(() => { scope.$eval(attrs.ngEnter); }); event.preventDefault(); } }); }; } } commonModule.directive('ngEnter', () => new NgEnterDirective()); export default commonModule;