Skip to content

Instantly share code, notes, and snippets.

@davidstump
Created September 16, 2014 15:02
Show Gist options
  • Save davidstump/d0b9f87f6a132c2991fb to your computer and use it in GitHub Desktop.
Save davidstump/d0b9f87f6a132c2991fb to your computer and use it in GitHub Desktop.
Delayed keyup directive
@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