Skip to content

Instantly share code, notes, and snippets.

@apolzon
Created April 25, 2014 22:37
Show Gist options
  • Save apolzon/11305497 to your computer and use it in GitHub Desktop.
Save apolzon/11305497 to your computer and use it in GitHub Desktop.
angular character count directive
HuntersAlley.directive "haCharacterCount", [ ->
scope:
object: "="
maxlength: "@"
template: """
<div class='listing-form__charactersRemaining'>
<span>Characters remaining:</span>
<span class='listing-form__count' ng-class="{'listing-form__countDanger': (maxlength - object.length) < 11}">
{{maxlength - object.length}}
</span>
</div>
"""
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment