do ->
'use strict'
LimitTo = () ->
return {
restrict: "A"
link: (scope, element, attrs) ->
limit = parseInt(attrs.limitTo)
element.on 'keydown', (event) ->
return if event.keyCode == 8
if @value.length == limit
event.preventDefault()
return
return
}
LimitTo.$inject = []
Sorry I just write coffeescript, you can always use this amazing tool js2.coffee, to get the javascript version of the code.