Commit 52a71489 authored by Aron Carroll's avatar Aron Carroll

Extract formValidate class name from JavaScript

It is now provided via the data-form-validate-error-class attribute.
parent 0e57b163
formValidate = ->
link: (scope, elem, attr, form) ->
errorClassName = attr.formValidateErrorClass
toggleClass = (field, {addClass}) ->
fieldEl = elem.find("[data-target=#{field.$name}]")
fieldEl.toggleClass('form-field-error', addClass)
fieldEl.toggleClass(errorClassName, addClass)
updateField = (field) ->
return unless field?
......
......@@ -34,7 +34,7 @@ describe 'h.directives', ->
$scope.model = {username: ''}
template = '''
<form form-validate name="login" onsubmit="return false">
<form form-validate data-form-validate-error-class="form-field-error" name="login" onsubmit="return false">
<div class="form-field" data-error-class="form-field-error" data-target="username">
<input type="text" class="" ng-model="model.username" name="username" required ng-minlength="3" />
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment