Created
September 16, 2014 15:02
-
-
Save davidstump/d0b9f87f6a132c2991fb to your computer and use it in GitHub Desktop.
Delayed keyup directive
This file contains 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 characters
@App.directive "onDelayedKeyup", ['$timeout', ($timeout) -> | |
(scope, element, attrs) -> | |
timer = false | |
element.bind "keyup", -> | |
$timeout.cancel(timer) if timer | |
timer = $timeout -> | |
scope.$apply attrs.onKeyup | |
, 500 | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment