Created
April 15, 2016 13:15
-
-
Save lean-stack/202da9bb50eb4449ffac88c8cca37d20 to your computer and use it in GitHub Desktop.
Revisions
-
michael-alt created this gist
Apr 15, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ (function() { 'use strict'; angular.module('todoApp') .directive('enterPressed', function() { return { restrict: 'A', scope: { enterPressed: '&' }, link: function(scope,$elt,attrs){ $elt.on('keypress', function(ev) { if( ev.which === 13 ) { scope.$apply( function() {scope.enterPressed();}); } }); } }; }); }());