Skip to content

Instantly share code, notes, and snippets.

@edymerchk
Created January 22, 2014 22:11
Show Gist options
  • Select an option

  • Save edymerchk/8568463 to your computer and use it in GitHub Desktop.

Select an option

Save edymerchk/8568463 to your computer and use it in GitHub Desktop.
directive "ngBlur", ->
(scope, elem, attrs) ->
elem.bind "blur", ->
scope.$apply attrs.ngBlur
directive "ngFocus", ($timeout) ->
(scope, elem, attrs) ->
scope.$watch attrs.ngFocus, (newval) ->
if newval
$timeout (->
elem[0].focus()
), 0, false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment